1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-29 00:10:21 +02:00

* ltconfig, ltmain.sh, config.guess: New files from libtool 0.9g.

This commit is contained in:
Jim Blandy 1997-06-12 02:59:33 +00:00
parent af8865f7d9
commit 393e4e4de7
3 changed files with 269 additions and 186 deletions

73
config.guess vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -68,11 +68,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-cbm-openbsd${UNAME_RELEASE}
exit 0 ;;
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc64:OpenBSD:*:*)
echo mips64el-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hkmips:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
@ -115,19 +136,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-atari-openbsd${UNAME_RELEASE}
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-sun-openbsd${UNAME_RELEASE}
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-apple-openbsd${UNAME_RELEASE}
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
@ -141,6 +168,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
2020:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >dummy.c
int main (argc, argv) int argc; char **argv; {
@ -375,8 +405,8 @@ EOF
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp3[0-9][05]:OpenBSD:*:*)
echo m68k-hp-openbsd${UNAME_RELEASE}
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@ -400,7 +430,7 @@ EOF
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
echo `echo ${UNAME_MACHINE}|sed -e 's,-.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# The BFD linker knows what the default object file format is, so
@ -422,6 +452,23 @@ EOF
echo alpha-unknown-linux-gnu ; exit 0
elif test "${UNAME_MACHINE}" = "sparc" ; then
echo sparc-unknown-linux-gnu ; exit 0
elif test "${UNAME_MACHINE}" = "mips" ; then
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __MIPSEB__
printf ("%s-unknown-linux-gnu\n", argv[1]);
#endif
#ifdef __MIPSEL__
printf ("%sel-unknown-linux-gnu\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
else
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
@ -529,6 +576,10 @@ EOF
echo ns32k-sni-sysv
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@ -548,10 +599,6 @@ EOF
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2

172
ltconfig
View file

@ -33,7 +33,7 @@ progname=`echo "$0" | sed 's%^.*/%%'`
# Constants:
PROGRAM=ltconfig
PACKAGE=libtool
VERSION=0.9e
VERSION=0.9g
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
rm="rm -f"
@ -87,6 +87,7 @@ Usage: $progname [OPTION]... LTMAIN [HOST]
Generate a system-specific libtool script.
--disable-shared do not build shared libraries
--disable-static do not build static libraries
--help display this help and exit
--no-verify do not verify that HOST is a valid host type
--quiet same as \`--silent'
@ -105,6 +106,8 @@ EOM
--disable-shared) enable_shared=no ;;
--disable-static) enable_static=no ;;
--quiet | --silent) silent=yes ;;
--srcdir) prev=srcdir ;;
@ -257,9 +260,9 @@ case "$host" in
*-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Determine commands to create old-style static archives.
old_archive_cmds='$AR cru $oldlib$oldobjs'
@ -370,7 +373,7 @@ if test "$with_gcc" = no; then
#endif
EOF
# LINENUM
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
with_gcc=yes
fi
$rm conftest.c
@ -395,45 +398,45 @@ if test "$with_gcc" = yes; then
link_static_flag='-static'
else
# PORTME Check for PIC flags for the system compiler.
case "$host" in
*-*-aix3* | *-*-aix4*)
case "$host_os" in
aix3* | aix4*)
# FIXME All rs/6000 code is PIC, but is there any non-rs/6000 AIX platform?
pic_flag=
link_static_flag='-bnso -bI:/lib/syscalls.exp'
;;
*-*-hpux9* | *-*-hpux10*)
hpux9* | hpux10*)
# FIXME is there a better link_static_flag that works with the bundled CC?
wl='-Wl,'
link_static_flag='${wl}-a ${wl}archive'
pic_flag='+Z'
;;
*-*-irix5* | *-*-irix6*)
irix5* | irix6*)
wl='-Wl,'
link_static_flag='-non_shared'
# PIC (with -KPIC) is the default.
pic_flag=
;;
*-*-osf3* | *-*-osf4*)
osf3* | osf4*)
# FIXME - pic_flag is probably required for hppa*-osf* and i860-osf*
wl='-Wl,'
link_static_flag='-non_shared'
;;
*-*-sco3.2v5*)
sco3.2v5*)
pic_flag='-Kpic'
link_static_flag='-dn'
special_shlib_compile_flags='-belf'
;;
*-*-solaris2*)
solaris2*)
pic_flag='-KPIC'
link_static_flag='-Bstatic'
;;
*-*-sunos4*)
sunos4*)
pic_flag='-PIC'
link_static_flag='-Bstatic'
wl='-Qoption ld '
@ -445,8 +448,8 @@ else
esac
fi
case "$host" in
rs6000-*-* | powerpc-*-* | powerpcle-*-*)
case "$host_cpu" in
rs6000 | powerpc | powerpcle)
# Yippee! All RS/6000 and PowerPC code is position-independent.
pic_flag=
;;
@ -469,6 +472,23 @@ if test -n "$special_shlib_compile_flags"; then
fi
fi
# See if we are using a broken GCC collect2 program.
if test "$with_gcc" = yes; then
echo $ac_n "checking for broken GCC collect2... $ac_c" 1>&6
# FIXME: Run a test here, instead of relying on the canonical system name.
case "$host_os" in
aix3*)
can_build_shared=no
echo $ac_t yes 1>&6
echo "$progname: to build shared libraries, set the CC env variable to \`xlc' and reconfigure" 1>&2
;;
*)
echo $ac_t no 1>&6
;;
esac
fi
echo $ac_n "checking for $compiler option to statically link programs... $ac_c" 1>&6
if test -n "$link_static_flag"; then
echo $ac_t "$link_static_flag" 1>&6
@ -483,6 +503,8 @@ with_gnu_ld=no
set dummy $LD
linker="$2"
echo $ac_n "checking if $LD is GNU ld... $ac_c" 1>&6
# I'd rather use --version here, but apparently some GNU ld's don't accept
# it, but do accept -v.
if $LD -v 2>&1 | egrep '(GNU ld|with BFD)' > /dev/null; then
with_gnu_ld=yes
linker="GNU ld"
@ -492,20 +514,23 @@ echo $ac_t "$with_gnu_ld" 1>&6
# See if the linker supports building shared libraries.
echo $ac_n "checking if $linker supports shared libraries... $ac_c" 1>&6
allow_undefined_flag=
archive_cmds=
export_dynamic_flag=
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
hardcode_runpath_var=no
hardcode_shlibpath_var=unsupported
runpath_var=
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# See if GNU ld supports shared libraries.
case "$host" in
*-*-sunos4*)
case "$host_os" in
sunos4*)
ld_shlibs=yes
hardcode_direct=yes
hardcode_shlibpath_var=no
@ -513,6 +538,8 @@ if test "$with_gnu_ld" = yes; then
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
ld_shlibs=yes
else
ld_shlibs=no
@ -527,47 +554,69 @@ if test "$with_gnu_ld" = yes; then
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case "$host" in
*-*-aix3*)
case "$host_os" in
aix3*)
allow_undefined_flag=unsupported
archive_cmds='/usr/ucb/nm$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
;;
*-*-aix4*)
aix4*)
allow_undefined_flag=unsupported
archive_cmds='/bin/nm -B$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
hardcode_direct=yes
hardcode_minus_L=yes
;;
*-*-freebsd*)
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# doesn't break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
# Unfortunately, older versions of FreeBSD 2 don't have this feature.
freebsd2*)
archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
*-*-hpux9*)
# FreeBSD 3, at last, uses gcc -shared to do shared libraries.
freebsd3*)
archive_cmds='$CC -shared -o $lib$libobjs$deplibs'
hardcode_direct=yes
hardcode_minusL=yes
hardcode_shlibpath_var=no
;;
hpux9*)
archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib'
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
*-*-hpux10*)
hpux10*)
archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs'
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
*-*-irix5* | *-*-irix6*)
irix5* | irix6*)
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
;;
*-*-netbsd*)
netbsd* | openbsd*)
# Tested with NetBSD 1.2 ld
archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
hardcode_libdir_flag_spec='-R$libdir'
@ -575,24 +624,25 @@ else
hardcode_shlibpath_var=no
;;
*-*-osf3* | *-*-osf4*)
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
osf3* | osf4*)
allow_undefined_flag=' -expect_unresolved'
archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
*-*-sco3.2v5*)
sco3.2v5*)
archive_cmds='$LD -G -o $lib$libobjs$deplibs'
hardcode_direct=yes
;;
*-*-solaris2*)
solaris2*)
archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
;;
*-*-sunos4*)
sunos4*)
archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
@ -611,10 +661,12 @@ echo $ac_t "$ld_shlibs" 1>&6
# Check hardcoding attributes.
echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
hardcode_action=
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_flag_spec" || \
test "$hardcode_runpath_var" = yes; then
# We can hardcode non-existant directories.
if test "$hardcode_direct" != no &&
test "$hardcode_minus_L" != no &&
if test "$hardcode_direct" != no && \
test "$hardcode_minus_L" != no && \
test "$hardcode_shlibpath_var" != no; then
# Linking always hardcodes the temporary library directory.
@ -623,8 +675,8 @@ if test -n "$hardcode_libdir_flag_spec"; then
# We can link without hardcoding, and we can hardcode nonexisting dirs.
hardcode_action=immediate
fi
elif test "$hardcode_direct" != yes &&
test "$hardcode_minus_L" != yes &&
elif test "$hardcode_direct" != yes && \
test "$hardcode_minus_L" != yes && \
test "$hardcode_shlibpath_var" != yes; then
# We can't hardcode anything.
hardcode_action=unsupported
@ -654,8 +706,8 @@ version_type=none
dynamic_linker="$host_os ld.so"
echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
case "$host" in
*-*-aix3* | *-*-aix4*)
case "$host_os" in
aix3* | aix4*)
version_type=linux
library_names_spec='$libname.so.$versuffix $libname.a'
shlibpath_var=LIBPATH
@ -664,16 +716,20 @@ case "$host" in
soname_spec='$libname.so.$major'
;;
*-*-freebsd*)
freebsd2* | freebsd3*)
version_type=sunos
library_names_spec='$libname.so.$versuffix $libname.so'
finish_cmds='ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
;;
# *-*-gnu* needs to come after *-*-linux-gnu*.
gnu*)
version_type=sunos
library_names_spec='$libname.so.$versuffix'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-hpux9* | *-*-hpux10*)
hpux9* | hpux10*)
# Give a soname corresponding to the major version so that dld.sl refuses to
# link against other versions.
dynamic_linker="$host_os dld.sl"
@ -685,7 +741,7 @@ case "$host" in
postinstall_cmds='chmod 555 $lib'
;;
*-*-irix5* | *-*-irix6*)
irix5* | irix6*)
version_type=osf
soname_spec='$libname.so'
library_names_spec='$libname.so.$versuffix $libname.so'
@ -693,13 +749,13 @@ case "$host" in
;;
# No shared lib support for Linux oldld, aout, or coff.
*-*-linux-gnuoldld* | *-*-linux-gnuaout* | *-*-linux-gnucoff*)
linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
dynamic_linker=no
can_build_shared=no
;;
# This must be Linux ELF.
*-*-linux-gnu*)
linux-gnu*)
version_type=linux
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so.$major'
@ -707,41 +763,35 @@ case "$host" in
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-gnu*)
version_type=sunos
library_names_spec='$libname.so.$versuffix'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-netbsd*)
netbsd* | openbsd*)
version_type=sunos
library_names_spec='$libname.so.$versuffix'
finish_cmds='ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-osf3* | *-*-osf4*)
osf3* | osf4*)
version_type=osf
soname_spec='$libname.so'
library_names_spec='$libname.so.$versuffix $libname.so'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-sco3.2v5*)
sco3.2v5*)
version_type=osf
soname_spec='$libname.so.$major'
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-solaris2*)
solaris2*)
version_type=linux
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so.$major'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-sunos4*)
sunos4*)
version_type=sunos
library_names_spec='$libname.so.$versuffix'
finish_cmds='ldconfig $libdir'
@ -801,6 +851,8 @@ echo "$ac_t""$enable_shared" 1>&6
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
echo "checking whether to build static libraries... $enable_static" 1>&6
ofile=libtool
trap "$rm $ofile; exit 1" 1 2 15
echo creating $ofile
@ -877,6 +929,9 @@ old_postinstall_cmds='$old_postinstall_cmds'
archive_cmds='$archive_cmds'
postinstall_cmds='$postinstall_cmds'
# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag='$allow_undefined_flag'
# Commands used to finish a libtool library installation in a directory.
finish_cmds='$finish_cmds'
@ -884,6 +939,9 @@ finish_cmds='$finish_cmds'
striplib='$striplib'
old_striplib='$old_striplib'
# This is the shared library runtime path variable.
runpath_var=$runpath_var
# This is the shared library path variable.
shlibpath_var=$shlibpath_var
@ -905,7 +963,11 @@ hardcode_direct=$hardcode_direct
# resulting binary.
hardcode_minus_L=$hardcode_minus_L
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the
# Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the
# resulting binary.
hardcode_runpath_var=$hardcode_runpath_var
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
# the resulting binary.
hardcode_shlibpath_var=$hardcode_shlibpath_var

210
ltmain.sh
View file

@ -28,7 +28,7 @@ progname=`echo "$0" | sed 's%^.*/%%'`
# Constants.
PROGRAM=ltmain.sh
PACKAGE=libtool
VERSION=0.9e
VERSION=0.9g
default_mode=NONE
help="Try \`$progname --help' for more information."
@ -143,7 +143,7 @@ if test -z "$show_help"; then
if test "$mode" = NONE; then
case "$nonopt" in
*cc)
if echo " $@ " | egrep "[ ]-c[ ]" > /dev/null 2>&1; then
if echo " $@ " | egrep -e "[ ]-c[ ]" > /dev/null 2>&1; then
mode=compile
else
mode=link
@ -229,9 +229,14 @@ if test -z "$show_help"; then
exit 1
fi
# Delete any old library objects.
$run $rm $obj $libobj
trap "$run $rm $obj $libobj; exit 1" 1 2 15
# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
$run $rm $obj $libobj
trap "$run $rm $obj $libobj; exit 1" 1 2 15
else
$run $rm $libobj
trap "$run $rm $libobj; exit 1" 1 2 15
fi
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
@ -239,7 +244,7 @@ if test -z "$show_help"; then
$show "$base_compile$pic_flag -DPIC $srcfile"
if eval "$run $base_compile$pic_flag -DPIC $srcfile"; then :
else
$run $rm $obj
test -n "$obj" && $run $rm $obj
exit 1
fi
@ -255,16 +260,18 @@ if test -z "$show_help"; then
$run $mv $obj $libobj || exit 1
fi
# Compile the position-dependent object.
$show "$base_compile $srcfile"
if eval "$run $base_compile $srcfile"; then :
else
$run $rm $obj $libobj
exit 1
# Only build a position-dependent object if we build old libraries.
if test "$build_old_libs" = yes; then
$show "$base_compile $srcfile"
if eval "$run $base_compile $srcfile"; then :
else
$run $rm $obj $libobj
exit 1
fi
fi
# Create an invalid object file if no PIC, so that we don't accidentally
# link it.
# Create an invalid libtool object if no PIC, so that we don't accidentally
# link it into a program.
if test "$build_libtool_libs" != yes; then
$show "echo timestamp > $libobj"
eval "$run echo timestamp > $libobj" || exit $?
@ -279,6 +286,7 @@ if test -z "$show_help"; then
# Go through the arguments, transforming them on the way.
cc="$nonopt"
args="$cc"
allow_undefined=no
compile_command="$cc"
finalize_command="$cc"
compile_shlibpath=
@ -292,12 +300,11 @@ if test -z "$show_help"; then
link_static=
ltlibs=
objs=
output=
prev=
prevarg=
perm_rpath=
temp_rpath=
vinfo=
whole_archive=no
# We need to know -static, to get the right output filenames.
case " $@ " in
@ -326,6 +333,8 @@ if test -z "$show_help"; then
prevarg="$arg"
case "$arg" in
-allow-undefined) allow_undefined=yes ;;
-export-dynamic)
export_dynamic=yes
compile_command="$compile_command $export_dynamic_flag"
@ -348,8 +357,6 @@ if test -z "$show_help"; then
-l*) deplibs="$deplibs $arg" ;;
-no-whole-archive) whole_archive=no ;;
-o) prev=output ;;
-rpath)
@ -374,8 +381,6 @@ if test -z "$show_help"; then
continue
;;
-whole-archive) whole_archive=yes ;;
-*) cc="$cc $arg" ;; # Some other compiler flag.
*.o)
@ -389,36 +394,8 @@ if test -z "$show_help"; then
dir=`echo "$arg" | sed 's%/[^/]*$%/%'`
test "$dir" = "$arg" && dir=
# If -whole-archive was specified, we need to link all the members.
if test "$whole_archive" = yes; then
if test -f $arg; then :
else
echo "$progname: \`$arg' does not exist" 1>&2
echo "$help" 1>&2
exit 1
fi
# Get the names of the members of the archive.
members=`$AR t $arg 2>/dev/null`
for m in $members; do
case "$m" in
*.lo) libobjs="$libobjs $dir$m" ;;
*.o)
if test "$build_libtool_libs" = yes; then
objs="$objs $dir$m"
else
libobjs="$libobjs $dir$m"
fi
;;
esac
done
elif test -f "$dir$objdir/$file"; then
# .libs/libfoo.a exists, so this is an archive of libobjects.
libobjs="$libobjs $arg"
else
# Standard archive.
objs="$objs $arg"
fi
# Standard archive.
objs="$objs $arg"
;;
*.lo)
@ -499,8 +476,15 @@ if test -z "$show_help"; then
compile_command="$compile_command $hardcode_libdir_flag"
finalize_command="$finalize_command $hardcode_libdir_flag"
fi
elif test "$hardcode_runpath_var" = yes; then
# Do the same for the permanent run path.
case "$perm_rpath " in
"* $libdir *") ;;
*) perm_rpath="$perm_rpath $libdir" ;;
esac
fi
case "$hardcode_action" in
immediate)
if test "$hardcode_direct" = no; then
@ -557,7 +541,11 @@ if test -z "$show_help"; then
fi
else
# Transform directly to old archives if we don't build new libraries.
test -z "$old_library" || linklib="$old_library"
if test -n "$pic_flag" && test -z "$old_library"; then
echo "$progname: cannot find static library for \`$arg'" 1>&2
exit 1
fi
test -n "$old_library" && linklib="$old_library"
compile_command="$compile_command $dir/$linklib"
finalize_command="$finalize_command $dir/$linklib"
fi
@ -601,20 +589,6 @@ if test -z "$show_help"; then
exit 1
;;
*.a)
# Old archive.
libname=`echo "$output" | sed 's/\.a$//'`
build_old_libs=yes
if test -n "$install_libdir"; then
echo "$progname: warning: \`-rpath' is ignored while linking old-style libraries" 1>&2
fi
if test -n "$vinfo"; then
echo "$progname: warning: \`-version-info' is ignored while linking old-style libraries" 1>&2
fi
;;
*.la)
libname=`echo "$output" | sed 's/\.la$//'`
@ -742,6 +716,17 @@ if test -z "$show_help"; then
$run $mkdir $objdir || exit $?
fi
# Check to see if the archive will have undefined symbols.
if test "$allow_undefined" = yes; then
if "$allow_undefined_flag" = unsupported; then
echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
build_libtool_libs=no
fi
else
# Clear the flag.
allow_undefined_flag=
fi
if test "$build_libtool_libs" = yes; then
# Get the real and link names of the library.
library_names=`eval echo \"$library_names_spec\"`
@ -825,9 +810,7 @@ if test -z "$show_help"; then
# Delete the old objects.
$run $rm $obj $libobj
# Create the old-style object (skipping any convenience libraries).
# FIXME: skipping them is simplistic. We should determine which members
# are actually needed to resolve symbols.
# Create the old-style object.
reload_objs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
output="$obj"
@ -876,6 +859,7 @@ if test -z "$show_help"; then
if test -n "$libobjs"; then
# Transform all the library objects into standard objects.
compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'`
fi
if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
@ -925,16 +909,27 @@ if test -z "$show_help"; then
;;
esac
done
temp_rpath="$rpath"
fi
# Delete the old output file.
$run $rm $output
if test -n "$compile_shlibpath"; then
compile_command="$shlibpath_var=$compile_shlibpath\$$shlibpath_var $compile_command"
compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
fi
if test -n "$finalize_shlibpath"; then
finalize_command="$shlibpath_var=$finalize_shlibpath\$$shlibpath_var $finalize_command"
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
fi
if test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
rpath="$rpath$dir:"
done
compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
fi
case "$hardcode_action" in
@ -971,8 +966,8 @@ if test -z "$show_help"; then
# This environment variable determines our operation mode.
if test "\$libtool_install_magic" = "$magic"; then
# install mode needs the following variables:
link_against_libtool_libs="$link_against_libtool_libs"
finalize_command="$finalize_command"
link_against_libtool_libs='$link_against_libtool_libs'
finalize_command='$finalize_command'
else
# Find the directory that this script lives in.
thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\`
@ -1000,11 +995,11 @@ else
EOF
# Export our shlibpath_var if we have one.
if test -n "$shlibpath_var" && test -n "$rpath"; then
if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
cat >> $output <<EOF
# Add our own library path to $shlibpath_var
$shlibpath_var="$rpath\$$shlibpath_var"
$shlibpath_var="$temp_rpath\$$shlibpath_var"
export $shlibpath_var
EOF
fi
@ -1036,9 +1031,7 @@ EOF
# Now set the variables for building old libraries.
oldlib="$objdir/$libname.a"
# Transform .lo files to .o (skipping convenience libraries).
# FIXME: skipping them is simplistic. We should determine which members
# are actually needed to resolve symbols.
# Transform .lo files to .o files.
oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
if test -d "$objdir"; then
@ -1058,38 +1051,6 @@ EOF
eval "$run $cmd" || exit $?
done
IFS="$save_ifs"
case "$output" in
*.a)
# Just move into place if there were any non-libtool objects.
if test -n "$objs"; then
$show "$mv $oldlib $output"
$run $mv $oldlib $output
elif test -z "$pic_flag" || test "$build_libtool_libs" != yes; then
# Just symlink if libtool objects are the same.
$show "$rm $output"
$run $rm $output
$show "$ln_s $oldlib $output"
$run $ln_s $oldlib $output
else
# Create an archive of libtool objects.
oldlib="$output"
oldobjs="$libobjs"
# Do each command in the archive commands.
cmds=`eval echo \"$old_archive_cmds\"`
IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
for cmd in $cmds; do
IFS="$save_ifs"
$show "$cmd"
eval "$run $cmd" || exit $?
done
IFS="$save_ifs"
fi
;;
esac
fi
# Now create the libtool archive.
@ -1106,15 +1067,15 @@ EOF
# $output - a libtool library file
# Generated by $PROGRAM - GNU $PACKAGE $VERSION
# The name that we can dlopen(3).
dlname='$dlname'
# Names of this library.
library_names='$library_names'
# The name of the static archive.
old_library='$old_library'
# The name that we can dlopen(3).
dlname='$dlname'
# Version information for $libname.
current=$current
age=$age
@ -1124,6 +1085,11 @@ revision=$revision
libdir='$install_libdir'
EOF
fi
# Do a symbolic link so that the libtool archive can be found in
# LD_LIBRARY_PATH before the program is installed.
$show "$ln_s ../$output $objdir/$output"
$run $ln_s ../$output $objdir/$output || $run $cp_p ../$output $objdir/$output || exit 1
;;
esac
exit 0
@ -1457,11 +1423,18 @@ EOF
ltlibs="$ltlibs $lib"
done
if test -z "$ltlibs"; then
echo "$progname: you must specify at least one LTLIBRARY" 1>&2
echo "$help" 1>&2
exit 1
fi
# Now check to make sure each one is a valid libtool library.
status=0
for lib in $ltlibs; do
dlname=
libdir=
library_names=
# Check to see that this really is a libtool archive.
if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
@ -1482,6 +1455,9 @@ EOF
status=1
elif test -n "$dlname"; then
echo "$libdir/$dlname"
elif test -z "$library_names"; then
echo "$progname: \`$arg' is not a shared library" 1>&2
status=1
else
echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
status=1
@ -1631,7 +1607,7 @@ EOF
dlname)
cat <<EOF
Usage: $progname [OPTION]... --mode=dlname LTLIBRARY [LTLIBRARY]...
Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
Print filenames to use to \`dlopen' libtool libraries.
@ -1681,16 +1657,15 @@ a program from several object files.
The following components of LINK-COMMAND are treated specially:
-export-dynamic allow the output file to be loaded with dlopen(3)
-allow-undefined allow a libtool library to reference undefined symbols
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-LLIBDIR search LIBDIR for required installed libraries
-lNAME OUTPUT-FILE requires the installed library libNAME
-no-whole-archive turn off \`-whole-archive'
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-static do not do any dynamic linking or shared library creation
-version-info CURRENT[:REVISION[:AGE]]
specify library version info [each variable defaults to 0]
-whole-archive use all members from subsequent \`.a' files
All other options (arguments beginning with \`-') are ignored.
@ -1702,8 +1677,7 @@ If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
library objects (\`.lo' files) may be specified, and \`-rpath' is required.
If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
and \`ranlib'. If only libtool objects are specified, then the output file
may be used in the creation of other libtool archives.
and \`ranlib'.
If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
created, otherwise an executable program is created.