1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

* ltconfig, ltmain.sh: Upgraded libtool files to 0.9d. It looks

like the 0.8 disty contains files that say "0.9" in the sources???
This commit is contained in:
Jim Blandy 1997-04-11 04:56:13 +00:00
parent 18eadcbefc
commit 4cdcd100f5
2 changed files with 367 additions and 140 deletions

144
ltconfig
View file

@ -33,7 +33,7 @@ progname=`echo "$0" | sed 's%^.*/%%'`
# Constants: # Constants:
PROGRAM=ltconfig PROGRAM=ltconfig
PACKAGE=libtool PACKAGE=libtool
VERSION=0.9 VERSION=0.9d
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
rm="rm -f" rm="rm -f"
@ -54,12 +54,15 @@ nonopt=NONE
verify_host=yes verify_host=yes
with_gcc=no with_gcc=no
old_AR="$AR"
old_CC="$CC" old_CC="$CC"
old_CFLAGS="$CFLAGS" old_CFLAGS="$CFLAGS"
old_CPPFLAGS="$CPPFLAGS" old_CPPFLAGS="$CPPFLAGS"
old_LD="$LD" old_LD="$LD"
old_RANLIB="$RANLIB" old_RANLIB="$RANLIB"
test -z "$AR" && AR=ar
# Parse the command line options. # Parse the command line options.
args= args=
prev= prev=
@ -240,6 +243,12 @@ if test "$verify_host" = yes; then
host=`$ac_config_sub $host_alias` host=`$ac_config_sub $host_alias`
echo "$ac_t""$host" 1>&6 echo "$ac_t""$host" 1>&6
# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
case "$host" in
*-*-linux-gnu*) ;;
*-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
elif test "$host" = NONE; then elif test "$host" = NONE; then
echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
echo "$help" 1>&2 echo "$help" 1>&2
@ -248,12 +257,18 @@ else
host_alias=$host host_alias=$host
fi fi
# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
case "$host" in
*-*-linux-gnu*) ;;
*-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
# Determine commands to create old-style static archives. # Determine commands to create old-style static archives.
old_archive_cmds='ar cru $oldlib$oldobjs' old_archive_cmds='$AR cru $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib' old_postinstall_cmds='chmod 644 $oldlib'
# If RANLIB is not set, then run the test. # If RANLIB is not set, then run the test.
@ -407,7 +422,7 @@ else
pic_flag= pic_flag=
;; ;;
*-*-osf3*) *-*-osf3* | *-*-osf4*)
# FIXME - pic_flag is probably required for hppa*-osf* and i860-osf* # FIXME - pic_flag is probably required for hppa*-osf* and i860-osf*
wl='-Wl,' wl='-Wl,'
link_static_flag='-non_shared' link_static_flag='-non_shared'
@ -474,7 +489,7 @@ with_gnu_ld=no
set dummy $LD set dummy $LD
linker="$2" linker="$2"
echo $ac_n "checking if $LD is GNU ld... $ac_c" 1>&6 echo $ac_n "checking if $LD is GNU ld... $ac_c" 1>&6
if $LD --version 2>&1 | egrep 'with BFD' > /dev/null; then if $LD --version 2>&1 | egrep '(GNU ld|with BFD)' > /dev/null; then
with_gnu_ld=yes with_gnu_ld=yes
linker="GNU ld" linker="GNU ld"
fi fi
@ -484,7 +499,9 @@ echo $ac_t "$with_gnu_ld" 1>&6
echo $ac_n "checking if $linker supports shared libraries... $ac_c" 1>&6 echo $ac_n "checking if $linker supports shared libraries... $ac_c" 1>&6
archive_cmds= archive_cmds=
hardcode_libdir_flag= export_dynamic_flag=
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no hardcode_direct=no
hardcode_minus_L=no hardcode_minus_L=no
hardcode_shlibpath_var=unsupported hardcode_shlibpath_var=unsupported
@ -511,20 +528,21 @@ if test "$with_gnu_ld" = yes; then
if test "$ld_shlibs" = yes; then if test "$ld_shlibs" = yes; then
archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
hardcode_libdir_flag='${wl}-rpath $wl$libdir' hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir'
export_dynamic_flag='${wl}-export-dynamic'
fi fi
else else
# PORTME fill in a description of your system's linker (not GNU ld) # PORTME fill in a description of your system's linker (not GNU ld)
case "$host" in case "$host" in
*-*-aix3*) *-*-aix3*)
archive_cmds='/usr/ucb/nm$libobjs | egrep \" D \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;ar cru $lib $objdir/$soname' 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'
test "$with_gcc" != yes && hardcode_direct=yes # Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes hardcode_minus_L=yes
;; ;;
*-*-aix4*) *-*-aix4*)
archive_cmds='/bin/nm -B$libobjs | egrep \" D \" | sed \"s/^.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;ar cru $lib $objdir/$soname' 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'
test "$with_gcc" != yes && hardcode_direct=yes
hardcode_minus_L=yes hardcode_minus_L=yes
;; ;;
@ -537,34 +555,35 @@ else
*-*-hpux9*) *-*-hpux9*)
archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib' archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib'
hardcode_libdir_flag='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_direct=yes hardcode_direct=yes
hardcode_minus_L=yes hardcode_minus_L=yes
;; ;;
*-*-hpux10*) *-*-hpux10*)
archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs'
hardcode_libdir_flag='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_direct=yes hardcode_direct=yes
hardcode_minus_L=yes hardcode_minus_L=yes
;; ;;
*-*-irix5* | *-*-irix6*) *-*-irix5* | *-*-irix6*)
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
hardcode_libdir_flag='${wl}-rpath ${wl}$libdir' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
;; ;;
*-*-netbsd*) *-*-netbsd*)
# Tested with NetBSD 1.2 ld # Tested with NetBSD 1.2 ld
archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
hardcode_libdir_flag='-R$libdir' hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes hardcode_direct=yes
hardcode_shlibpath_var=no hardcode_shlibpath_var=no
;; ;;
*-*-osf3*) *-*-osf3* | *-*-osf4*)
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
hardcode_libdir_flag='${wl}-rpath ${wl}$libdir' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;; ;;
*-*-sco3.2v5*) *-*-sco3.2v5*)
@ -574,13 +593,13 @@ else
*-*-solaris2*) *-*-solaris2*)
archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs'
hardcode_libdir_flag='-R$libdir' hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no hardcode_shlibpath_var=no
;; ;;
*-*-sunos4*) *-*-sunos4*)
archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
hardcode_libdir_flag='-L$libdir' hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes hardcode_direct=yes
hardcode_minus_L=yes hardcode_minus_L=yes
hardcode_shlibpath_var=no hardcode_shlibpath_var=no
@ -597,7 +616,7 @@ echo $ac_t "$ld_shlibs" 1>&6
# Check hardcoding attributes. # Check hardcoding attributes.
echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
hardcode_action= hardcode_action=
if test -n "$hardcode_libdir_flag"; then if test -n "$hardcode_libdir_flag_spec"; then
# We can hardcode non-existant directories. # We can hardcode non-existant directories.
if test "$hardcode_direct" != no && if test "$hardcode_direct" != no &&
test "$hardcode_minus_L" != no && test "$hardcode_minus_L" != no &&
@ -606,14 +625,14 @@ if test -n "$hardcode_libdir_flag"; then
# Can't link without hardcoding. # Can't link without hardcoding.
hardcode_action=relink hardcode_action=relink
else else
hardcode_action=rpath hardcode_action=immediate
fi fi
elif test "$hardcode_direct" = yes || elif test "$hardcode_direct" = yes ||
test "$hardcode_minus_L" = yes || test "$hardcode_minus_L" = yes ||
test "$hardcode_shlibpath_var" = yes; then test "$hardcode_shlibpath_var" = yes; then
# We can't hardcode non-existant directories, but we can existing ones. # We can't hardcode non-existant directories, but we can existing ones.
hardcode_action=relink hardcode_action=immediate
else else
# We can't hardcode anything. # We can't hardcode anything.
hardcode_action=unsupported hardcode_action=unsupported
@ -631,7 +650,7 @@ echo $ac_t "$reload_flag"
test -n "$reload_flag" && reload_flag=" $reload_flag" test -n "$reload_flag" && reload_flag=" $reload_flag"
# PORTME Fill in your ld.so characteristics # PORTME Fill in your ld.so characteristics
lib_names= library_names_spec=
soname_spec= soname_spec=
postinstall_cmds= postinstall_cmds=
finish_cmds= finish_cmds=
@ -642,11 +661,8 @@ dynamic_linker="$host_os ld.so"
echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
case "$host" in case "$host" in
*-*-aix3* | *-*-aix4*) *-*-aix3* | *-*-aix4*)
# Shared libraries and static libraries currently use the same namespace.
test "$enable_shared" = no || enable_static=no
version_type=linux version_type=linux
lib_names='$libname.so.$versuffix $libname.a' library_names_spec='$libname.so.$versuffix $libname.a'
shlibpath_var=LIBPATH shlibpath_var=LIBPATH
# AIX has no versioning support, so we append a major version to the name. # AIX has no versioning support, so we append a major version to the name.
@ -655,16 +671,12 @@ case "$host" in
*-*-freebsd*) *-*-freebsd*)
version_type=sunos version_type=sunos
lib_names='$libname.so.$versuffix $libname.so' library_names_spec='$libname.so.$versuffix $libname.so'
finish_cmds='ldconfig -m $libdir' finish_cmds='ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
;; ;;
*-*-gnu*) # *-*-gnu* needs to come after *-*-linux-gnu*.
version_type=sunos
lib_names='$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 # Give a soname corresponding to the major version so that dld.sl refuses to
@ -672,7 +684,7 @@ case "$host" in
dynamic_linker="$host_os dld.sl" dynamic_linker="$host_os dld.sl"
version_type=sunos version_type=sunos
shlibpath_var=SHLIB_PATH shlibpath_var=SHLIB_PATH
lib_names='$libname.sl.$versuffix $libname.sl.$major $libname.sl' library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl'
soname_spec='$libname.sl.$major' soname_spec='$libname.sl.$major'
# HP-UX runs *really* slowly unless shared libraries are mode 555. # HP-UX runs *really* slowly unless shared libraries are mode 555.
postinstall_cmds='chmod 555 $lib' postinstall_cmds='chmod 555 $lib'
@ -681,55 +693,62 @@ case "$host" in
*-*-irix5* | *-*-irix6*) *-*-irix5* | *-*-irix6*)
version_type=osf version_type=osf
soname_spec='$libname.so' soname_spec='$libname.so'
lib_names='$libname.so.$versuffix $libname.so' library_names_spec='$libname.so.$versuffix $libname.so'
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
;; ;;
# No shared lib support for linuxoldld or linuxaout. # No shared lib support for Linux oldld, aout, or coff.
*-*-linuxoldld* | *-*-linuxaout*) *-*-linux-gnuoldld* | *-*-linux-gnuaout* | *-*-linux-gnucoff*)
dynamic_linker=no dynamic_linker=no
can_build_shared=no can_build_shared=no
;; ;;
*-*-linux*) # This must be Linux ELF.
*-*-linux-gnu*)
version_type=linux version_type=linux
lib_names='$libname.so.$versuffix $libname.so.$major $libname.so' library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so.$major' soname_spec='$libname.so.$major'
finish_cmds='ldconfig -n $libdir' finish_cmds='ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
;; ;;
*-*-gnu*)
version_type=sunos
library_names_spec='$libname.so.$versuffix'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-netbsd*) *-*-netbsd*)
version_type=sunos version_type=sunos
lib_names='$libname.so.$versuffix' library_names_spec='$libname.so.$versuffix'
finish_cmds='ldconfig -m $libdir' finish_cmds='ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
;; ;;
*-*-osf3*) *-*-osf3* | *-*-osf4*)
version_type=osf version_type=osf
soname_spec='$libname.so' soname_spec='$libname.so'
lib_names='$libname.so.$versuffix $libname.so' library_names_spec='$libname.so.$versuffix $libname.so'
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
;; ;;
*-*-sco3.2v5*) *-*-sco3.2v5*)
version_type=osf version_type=osf
soname_spec='$libname.so.$major' soname_spec='$libname.so.$major'
lib_names='$libname.so.$versuffix $libname.so.$major $libname.so' library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
;; ;;
*-*-solaris2*) *-*-solaris2*)
version_type=linux version_type=linux
lib_names='$libname.so.$versuffix $libname.so.$major $libname.so' library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so.$major' soname_spec='$libname.so.$major'
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
;; ;;
*-*-sunos4*) *-*-sunos4*)
version_type=sunos version_type=sunos
lib_names='$libname.so.$versuffix' library_names_spec='$libname.so.$versuffix'
finish_cmds='ldconfig $libdir' finish_cmds='ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
;; ;;
@ -771,21 +790,21 @@ echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
test "$can_build_shared" = "no" && enable_shared=no test "$can_build_shared" = "no" && enable_shared=no
if test "$enable_shared" = yes; then # On AIX, shared libraries and static libraries use the same namespace.
# On AIX, we do not build both static and shared libraries. case "$host_os" in
case "$host_os" in aix*)
aix*) test "$enable_shared" = yes && enable_static=no
test "$enable_static" = yes && enable_static=no if test -n "$RANLIB"; then
if test -n "$RANLIB"; then archive_cmds="$archive_cmds;\$RANLIB \$lib"
archive_cmds="$archive_cmds;\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib'
postinstall_cmds='$RANLIB $lib' fi
fi ;;
;; esac
esac
fi
echo "$ac_t""$enable_shared" 1>&6 echo "$ac_t""$enable_shared" 1>&6
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
ofile=libtool ofile=libtool
trap "$rm $ofile; exit 1" 1 2 15 trap "$rm $ofile; exit 1" 1 2 15
@ -819,6 +838,9 @@ build_old_libs=$enable_static
host_alias="$host_alias" host_alias="$host_alias"
host="$host" host="$host"
# The archiver.
AR='$AR'
# The linker used to build libraries. # The linker used to build libraries.
LD='$LD' LD='$LD'
@ -835,6 +857,9 @@ pic_flag='$pic_flag'
# Compiler flag to prevent dynamic linking. # Compiler flag to prevent dynamic linking.
link_static_flag='$link_static_flag' link_static_flag='$link_static_flag'
# Compiler flag to allow reflexive dlopens.
export_dynamic_flag='$export_dynamic_flag'
# Pattern to match compiler flags for creating libNAME_p libraries: # Pattern to match compiler flags for creating libNAME_p libraries:
profile_flag_pattern='$profile_flag_pattern' profile_flag_pattern='$profile_flag_pattern'
@ -843,7 +868,7 @@ version_type=$version_type
# List of archive names. First name is the real one, the rest are links. # List of archive names. First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME. # The last name is the one that the linker finds with -lNAME.
lib_names='$lib_names' library_names_spec='$library_names_spec'
# The coded name of the library, if different from the real name. # The coded name of the library, if different from the real name.
soname_spec='$soname_spec' soname_spec='$soname_spec'
@ -872,7 +897,10 @@ hardcode_action=$hardcode_action
# Flag to hardcode \$libdir into a binary during linking. # Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist. # This must work even if \$libdir does not exist.
hardcode_libdir_flag='$hardcode_libdir_flag' hardcode_libdir_flag_spec='$hardcode_libdir_flag_spec'
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator='$hardcode_libdir_separator'
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary. # resulting binary.

363
ltmain.sh
View file

@ -28,7 +28,7 @@ progname=`echo "$0" | sed 's%^.*/%%'`
# Constants. # Constants.
PROGRAM=ltmain.sh PROGRAM=ltmain.sh
PACKAGE=libtool PACKAGE=libtool
VERSION=0.9 VERSION=0.9d
default_mode=NONE default_mode=NONE
help="Try \`$progname --help' for more information." help="Try \`$progname --help' for more information."
@ -46,6 +46,13 @@ if test "$LTCONFIG_VERSION" != "$VERSION"; then
exit 1 exit 1
fi fi
#
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
echo "$progname: not configured to build any kind of library" 1>&2
echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
exit 1
fi
# Global variables. # Global variables.
mode=$default_mode mode=$default_mode
nonopt= nonopt=
@ -148,13 +155,16 @@ if test -z "$show_help"; then
*rm) *rm)
mode=uninstall mode=uninstall
;; ;;
*.la)
mode=dlname
;;
*) *)
# Just use the default operation mode. # Just use the default operation mode.
if test "$mode" = NONE; then if test "$mode" = NONE; then
if test -n "$nonopt"; then if test -n "$nonopt"; then
echo "$progname: warning: cannot infer operation mode from \`$nonopt $@'" 1>&2 echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
else else
echo "$progname: warning: cannot infer operation mode from no MODE-ARGS" 1>&2 echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
fi fi
fi fi
;; ;;
@ -169,6 +179,7 @@ if test -z "$show_help"; then
case "$mode" in case "$mode" in
# libtool compile mode # libtool compile mode
compile) compile)
progname="$progname: compile"
# Get the compilation command and the source file. # Get the compilation command and the source file.
base_compile="$nonopt" base_compile="$nonopt"
lastarg= lastarg=
@ -264,6 +275,7 @@ if test -z "$show_help"; then
# libtool link mode # libtool link mode
link) link)
progname="$progname: link"
# Go through the arguments, transforming them on the way. # Go through the arguments, transforming them on the way.
cc="$nonopt" cc="$nonopt"
args="$cc" args="$cc"
@ -272,6 +284,8 @@ if test -z "$show_help"; then
compile_shlibpath= compile_shlibpath=
finalize_shlibpath= finalize_shlibpath=
deplibs= deplibs=
export_dynamic=no
hardcode_libdirs=
install_libdir= install_libdir=
libobjs= libobjs=
link_against_libtool_libs= link_against_libtool_libs=
@ -283,18 +297,11 @@ if test -z "$show_help"; then
prevarg= prevarg=
temp_rpath= temp_rpath=
vinfo= vinfo=
whole_archive=no
# FIXME Maybe set the library names to libNAME_p.a if we are doing profiling.
# if echo " $@ " | egrep "[ ]$profile_flag_pattern[ ]" > /dev/null 2>&1; then
# suffix=p
# else
# suffix=
# fi
# We need to know -static, to get the right output filenames. # We need to know -static, to get the right output filenames.
case " $@ " in case " $@ " in
*" -static "*) build_libtool_libs=no ;; *" -static "*) build_libtool_libs=no build_old_libs=yes ;;
esac esac
for arg for arg
@ -303,13 +310,8 @@ if test -z "$show_help"; then
if test -n "$prev"; then if test -n "$prev"; then
case "$prev" in case "$prev" in
output) output)
if test "$build_libtool_libs" = yes; then compile_command="$compile_command @OUTPUT@"
compile_command="$compile_command $objdir/$arg" finalize_command="$finalize_command @OUTPUT@"
finalize_command="$finalize_command $objdir/$arg"T
else
compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg"
fi
args="$args $arg" args="$args $arg"
;; ;;
esac esac
@ -324,6 +326,13 @@ if test -z "$show_help"; then
prevarg="$arg" prevarg="$arg"
case "$arg" in case "$arg" in
-export-dynamic)
export_dynamic=yes
compile_command="$compile_command $export_dynamic_flag"
finalize_command="$finalize_command $export_dynamic_flag"
continue
;;
-L*) -L*)
dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'` dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
case "$dir" in case "$dir" in
@ -339,6 +348,8 @@ if test -z "$show_help"; then
-l*) deplibs="$deplibs $arg" ;; -l*) deplibs="$deplibs $arg" ;;
-no-whole-archive) whole_archive=no ;;
-o) prev=output ;; -o) prev=output ;;
-rpath) -rpath)
@ -363,13 +374,53 @@ if test -z "$show_help"; then
continue continue
;; ;;
-whole-archive) whole_archive=yes ;;
-*) cc="$cc $arg" ;; # Some other compiler flag. -*) cc="$cc $arg" ;; # Some other compiler flag.
*.o | *.a) *.o)
# A standard object. # A standard object.
objs="$objs $arg" objs="$objs $arg"
;; ;;
*.a)
# Find the relevant object directory and library name.
file=`echo "$arg" | sed 's%^.*/%%'`
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
;;
*.lo) *.lo)
# A library object. # A library object.
libobjs="$libobjs $arg" libobjs="$libobjs $arg"
@ -400,12 +451,17 @@ if test -z "$show_help"; then
exit 1 exit 1
fi fi
# Get the name of the link library. # Get the name of the library we link against.
linklib= linklib=
for linklib in $library_names; do for l in $old_library $library_names; do
: linklib="$l"
done done
if test -z "$linklib"; then
echo "$progname: cannot find name of link library for \`$arg'" 1>&2
exit 1
fi
# Find the relevant object directory and library name. # Find the relevant object directory and library name.
name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'` name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'`
dir=`echo "$arg" | sed 's%/[^/]*$%%'` dir=`echo "$arg" | sed 's%/[^/]*$%%'`
@ -426,19 +482,28 @@ if test -z "$show_help"; then
esac esac
fi fi
if test -z "$linklib"; then if test -n "$hardcode_libdir_flag_spec"; then
echo "$progname: cannot find name of link library for \`$arg'" 1>&2 if test -n "$hardcode_libdir_separator"; then
exit 1 if test -z "$hardcode_libdirs"; then
fi # Put the magic libdir with the hardcode flag.
hardcode_libdirs="$libdir"
libdir="@HARDCODE_LIBDIRS@"
else
# Just accumulate the libdirs.
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
libdir=
fi
fi
if test -n "$hardcode_libdir_flag"; then if test -n "$libdir"; then
tmp=`eval echo \"$hardcode_libdir_flag\"` hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"`
compile_command="$compile_command $tmp" compile_command="$compile_command $hardcode_libdir_flag"
finalize_command="$finalize_command $tmp" finalize_command="$finalize_command $hardcode_libdir_flag"
fi
fi fi
case "$hardcode_action" in case "$hardcode_action" in
rpath) immediate)
if test "$hardcode_direct" = no; then if test "$hardcode_direct" = no; then
compile_command="$compile_command $dir/$linklib" compile_command="$compile_command $dir/$linklib"
elif test "$hardcode_minus_L" = no; then elif test "$hardcode_minus_L" = no; then
@ -472,22 +537,30 @@ if test -z "$show_help"; then
compile_command="$compile_command -l$name" compile_command="$compile_command -l$name"
fi fi
;; ;;
*)
echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
exit 1
;;
esac esac
# Finalize command for both is simple: just hardcode it. # Finalize command for both is simple: just hardcode it.
if test "$hardcode_direct" = yes; then if test "$hardcode_direct" = yes; then
finalize_command="$finalize_command $libdir/$linklib" finalize_command="$finalize_command $libdir/$linklib"
elif test "$hardcode_minus_L" = no; then elif test "$hardcode_minus_L" = yes; then
finalize_command="$finalize_command -L$libdir -l$name" finalize_command="$finalize_command -L$libdir -l$name"
elif test "$hardcode_shlibpath_var" = no; then elif test "$hardcode_shlibpath_var" = yes; then
finalize_shlibpath="$finalize_shlibpath$libdir:" finalize_shlibpath="$finalize_shlibpath$libdir:"
finalize_command="$finalize_command -l$name" finalize_command="$finalize_command -l$name"
else
# We can't seem to hardcode it, guess we'll fake it.
finalize_command="$finalize_command -L$libdir -l$name"
fi fi
else else
# Transform directly to old archives if we don't build new libraries. # Transform directly to old archives if we don't build new libraries.
test -z "$old_library" && old_library="$linklib" test -z "$old_library" || linklib="$old_library"
compile_command="$compile_command $dir/$old_library" compile_command="$compile_command $dir/$linklib"
finalize_command="$finalize_command $dir/$old_library" finalize_command="$finalize_command $dir/$linklib"
fi fi
continue continue
;; ;;
@ -509,6 +582,12 @@ if test -z "$show_help"; then
exit 1 exit 1
fi fi
# Substitute the hardcoded libdirs into the compile commands.
if test "$hardcode_libdir_colon_separated" = yes; then
compile_command=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
finalize_command=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
fi
oldlib= oldlib=
oldobjs= oldobjs=
case "$output" in case "$output" in
@ -525,6 +604,7 @@ if test -z "$show_help"; then
*.a) *.a)
# Old archive. # Old archive.
libname=`echo "$output" | sed 's/\.a$//'`
build_old_libs=yes build_old_libs=yes
if test -n "$install_libdir"; then if test -n "$install_libdir"; then
@ -539,14 +619,22 @@ if test -z "$show_help"; then
*.la) *.la)
libname=`echo "$output" | sed 's/\.la$//'` libname=`echo "$output" | sed 's/\.la$//'`
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
dlname=
current=0
revision=0
age=0
if test -n "$objs"; then if test -n "$objs"; then
echo "$progname: cannot build libtool library \`$output' from non-libtool objects" echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
exit 1 exit 1
fi fi
# How the heck are we supposed to write a wrapper for a shared library? # How the heck are we supposed to write a wrapper for a shared library?
if test -n "$link_against_libtool_libs"; then if test -n "$link_against_libtool_libs"; then
echo "$progname: libtool libraries may not depend on uninstalled libraries" 1>&2 echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
exit 1 exit 1
fi fi
@ -555,10 +643,6 @@ if test -z "$show_help"; then
exit 1 exit 1
fi fi
current=0
revision=0
age=0
# Parse the version information argument. # Parse the version information argument.
IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
set dummy $vinfo set dummy $vinfo
@ -661,7 +745,7 @@ if test -z "$show_help"; then
if test "$build_libtool_libs" = yes; then if test "$build_libtool_libs" = yes; then
# Get the real and link names of the library. # Get the real and link names of the library.
library_names=`eval echo \"$lib_names\"` library_names=`eval echo \"$library_names_spec\"`
set dummy $library_names set dummy $library_names
realname="$2" realname="$2"
shift; shift shift; shift
@ -697,6 +781,12 @@ if test -z "$show_help"; then
$show "$ln_s $realname $link" $show "$ln_s $realname $link"
$run $ln_s $realname $link || exit $? $run $ln_s $realname $link || exit $?
done done
# If -export-dynamic was specified, set the dlname.
if test "$export_dynamic" = yes; then
# On all known operating systems, these are identical.
dlname="$soname"
fi
fi fi
;; ;;
@ -736,8 +826,10 @@ if test -z "$show_help"; then
# Delete the old objects. # Delete the old objects.
$run $rm $obj $libobj $run $rm $obj $libobj
# Create the old-style object. # Create the old-style object (skipping any convenience libraries).
reload_objs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` # FIXME: skipping them is simplistic. We should determine which members
# are actually needed to resolve symbols.
reload_objs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
output="$obj" output="$obj"
cmds=`eval echo \"$reload_cmds\"` cmds=`eval echo \"$reload_cmds\"`
@ -788,6 +880,10 @@ if test -z "$show_help"; then
fi fi
if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
# Replace the output file specification.
compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
# We have no uninstalled library dependencies, so finalize right now. # We have no uninstalled library dependencies, so finalize right now.
$show "$compile_command" $show "$compile_command"
$run $compile_command $run $compile_command
@ -804,6 +900,10 @@ if test -z "$show_help"; then
exit $status exit $status
fi fi
# Replace the output file specification.
compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
# Create the binary in the object directory, then wrap it. # Create the binary in the object directory, then wrap it.
if test -d $objdir; then : if test -d $objdir; then :
else else
@ -934,19 +1034,21 @@ EOF
# See if we need to build an old-fashioned archive. # See if we need to build an old-fashioned archive.
if test "$build_old_libs" = "yes"; then if test "$build_old_libs" = "yes"; then
# Transform .lo files to .o # Now set the variables for building old libraries.
oldobjs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` oldlib="$objdir/$libname.a"
case "$output" in
*.la) # Transform .lo files to .o (skipping convenience libraries).
# Now set the variables for building old libraries. # FIXME: skipping them is simplistic. We should determine which members
oldlib="$objdir/$libname.a" # are actually needed to resolve symbols.
;; oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
*)
oldlib="$output" if test -d "$objdir"; then
$show "$rm $oldlib" $show "$rm $oldlib"
$run $rm $oldlib $run $rm $oldlib
;; else
esac $show "$mkdir $objdir"
$run $mkdir $objdir
fi
# Do each command in the archive commands. # Do each command in the archive commands.
cmds=`eval echo \"$old_archive_cmds\"` cmds=`eval echo \"$old_archive_cmds\"`
@ -957,6 +1059,38 @@ EOF
eval "$run $cmd" || exit $? eval "$run $cmd" || exit $?
done done
IFS="$save_ifs" 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 fi
# Now create the libtool archive. # Now create the libtool archive.
@ -979,6 +1113,9 @@ library_names='$library_names'
# The name of the static archive. # The name of the static archive.
old_library='$old_library' old_library='$old_library'
# The name that we can dlopen(3).
dlname='$dlname'
# Version information for $libname. # Version information for $libname.
current=$current current=$current
age=$age age=$age
@ -995,6 +1132,7 @@ EOF
# libtool install mode # libtool install mode
install) install)
progname="$progname: install"
# The first argument is the name of the installation program. # The first argument is the name of the installation program.
install_prog="$nonopt" install_prog="$nonopt"
@ -1137,6 +1275,7 @@ EOF
# Install the shared library and build the symlinks. # Install the shared library and build the symlinks.
$show "$install_prog $dir/$realname $destdir/$realname" $show "$install_prog $dir/$realname $destdir/$realname"
eval "$run $install_prog $dir/$realname $destdir/$realname" || exit $? eval "$run $install_prog $dir/$realname $destdir/$realname" || exit $?
test "X$dlname" = "X$realname" && dlname=
# Support stripping libraries. # Support stripping libraries.
if test -n "$stripme"; then if test -n "$stripme"; then
@ -1161,11 +1300,18 @@ EOF
# ... and create new ones. # ... and create new ones.
for linkname for linkname
do do
test "X$dlname" = "X$linkname" && dlname=
$show "$ln_s $realname $destdir/$linkname" $show "$ln_s $realname $destdir/$linkname"
$run $ln_s $realname $destdir/$linkname $run $ln_s $realname $destdir/$linkname
done done
fi fi
if test -n "$dlname"; then
# Install the dynamically-loadable library.
$show "$install_prog $dir/$dlname $destdir/$dlname"
eval "$run $install_prog $dir/$dlname $destdir/$dlname" || exit $?
fi
# Do each command in the postinstall commands. # Do each command in the postinstall commands.
lib="$destdir/$realname" lib="$destdir/$realname"
cmds=`eval echo \"$postinstall_cmds\"` cmds=`eval echo \"$postinstall_cmds\"`
@ -1259,15 +1405,6 @@ EOF
esac esac
done done
# FIXME Install any profiled libraries, too.
# newfiles=
# for file in $staticlibs; do
# newfiles="$newfiles $file"
# pfile=`echo "$file" | sed 's/\.a$/_p.a/'`
# test -f "$pfile" && newfiles="$newfiles $pfile"
# done
# staticlibs="$newfiles"
for file in $staticlibs; do for file in $staticlibs; do
name=`echo "$file" | sed 's%^.*/%%'` name=`echo "$file" | sed 's%^.*/%%'`
@ -1312,8 +1449,51 @@ EOF
exit 0 exit 0
;; ;;
# libtool dlname mode
dlname)
progname="$progname: dlname"
ltlibs="$nonopt"
for lib
do
ltlibs="$ltlibs $lib"
done
# Now check to make sure each one is a valid libtool library.
status=0
for lib in $ltlibs; do
dlname=
libdir=
# Check to see that this really is a libtool archive.
if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
else
echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
status=1
continue
fi
# If there is no directory component, then add one.
case "$arg" in
*/*) . $arg ;;
*) . ./$arg ;;
esac
if test -z "$libdir"; then
echo "$progname: \`$arg' contains no -rpath information" 1>&2
status=1
elif test -n "$dlname"; then
echo "$libdir/$dlname"
else
echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
status=1
fi
done
exit $status
;;
# libtool finish mode # libtool finish mode
finish) finish)
progname="$progname: finish"
libdirs="$nonopt" libdirs="$nonopt"
if test -n "$finish_cmds" && test -n "$libdirs"; then if test -n "$finish_cmds" && test -n "$libdirs"; then
@ -1345,6 +1525,7 @@ EOF
# libtool uninstall mode # libtool uninstall mode
uninstall) uninstall)
progname="$progname: uninstall"
rm="$nonopt" rm="$nonopt"
files= files=
@ -1367,6 +1548,8 @@ EOF
test "$dir" = "$file" && dir=. test "$dir" = "$file" && dir=.
name=`echo "$file" | sed -e 's%^.*/%%'` name=`echo "$file" | sed -e 's%^.*/%%'`
rmfiles="$file"
case "$name" in case "$name" in
*.la) *.la)
# Possibly a libtool archive, so verify it. # Possibly a libtool archive, so verify it.
@ -1375,21 +1558,19 @@ EOF
# Delete the libtool libraries and symlinks. # Delete the libtool libraries and symlinks.
for n in $library_names; do for n in $library_names; do
$show "$rm $dir/$n" rmfiles="$rmfiles $dir/$n"
$run $rm $dir/$n test "X$n" = "X$dlname" && dlname=
done done
test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
# Delete the old-fashioned archive. # FIXME: should reinstall the best remaining shared library.
if test -n "$old_library"; then
$show "$rm $dir/$old_library"
$run $rm $dir/$old_library
fi
fi fi
;; ;;
esac esac
$show "$rm $file" $show "$rm $rmfiles"
$run $rm $file $run $rm $rmfiles
done done
exit 0 exit 0
;; ;;
@ -1423,6 +1604,7 @@ Provide generalized library-building support services.
MODE must be one of the following: MODE must be one of the following:
compile compile a source file into a libtool object compile compile a source file into a libtool object
dlname print filenames to use to \`dlopen' libtool libraries
finish complete the installation of libtool libraries finish complete the installation of libtool libraries
install install libraries or executables install install libraries or executables
link create a library or an executable link create a library or an executable
@ -1448,6 +1630,19 @@ library object suffix, \`.lo'.
EOF EOF
;; ;;
dlname)
cat <<EOF
Usage: $progname [OPTION]... --mode=dlname LTLIBRARY [LTLIBRARY]...
Print filenames to use to \`dlopen' libtool libraries.
Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
was linked using the \`-export-dynamic' option).
The names to use are printed to standard output, one per line.
EOF
;;
finish) finish)
cat <<EOF cat <<EOF
Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
@ -1487,13 +1682,16 @@ a program from several object files.
The following components of LINK-COMMAND are treated specially: The following components of LINK-COMMAND are treated specially:
-LLIBDIR search LIBDIR for required installed libraries -export-dynamic allow the output file to be loaded with dlopen(3)
-lNAME OUTPUT-FILE requires the installed library libNAME -LLIBDIR search LIBDIR for required installed libraries
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects -lNAME OUTPUT-FILE requires the installed library libNAME
-rpath LIBDIR the created library will eventually be installed in LIBDIR -no-whole-archive turn off \`-whole-archive'
-static do not do any dynamic linking or shared library creation -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]] -version-info CURRENT[:REVISION[:AGE]]
specify library version info [each variable defaults to 0] 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. All other options (arguments beginning with \`-') are ignored.
@ -1505,7 +1703,8 @@ 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. 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' If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
and \`ranlib'. and \`ranlib'. If only libtool objects are specified, then the output file
may be used in the creation of other libtool archives.
If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
created, otherwise an executable program is created. created, otherwise an executable program is created.