*** empty log message ***

This commit is contained in:
Gordon Matzigkeit 1997-04-01 19:00:38 +00:00 committed by Gordon Matzigkeit
parent 185ee37bb4
commit ae2ee26b65
12 changed files with 217 additions and 84 deletions

View File

@ -1,5 +1,29 @@
Thu Jan 16 17:57:38 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* demo/Makefile.am (hc-direct): Do better searching for the proper
name to do a direct link.
(hc-libpath): Make allowances if shlibpath_var cannot be used
to find libraries at link time, such as on AIX.
* Makefile.am (demo_distfiles): Remove ansi2knr.1 and ansi2knr.c.
* demo/foo.c, demo/hello.c, demo/main.c: Change ANSI prototypes to
KNR form, for better portability, and less ansi2knr hair.
* demo/configure.in: Remove AM_FUNC_PROTOTYPES.
* demo/Makefile.am: Remove ansi2knr from the AUTOMAKE_OPTIONS.
* demo/ansi2knr.1, demo/ansi2knr.c: Removed these files.
* ltmain.sh.in: Use 1>&2 consistently to direct errors and
warnings to stderr.
(compile): Fix missing single quote.
* ltconfig.in (hardcode_direct): On Solaris at least, using
DIR/libNAME.so does not hardcode DIR, so introduce a new hardcode
variable to reflect that.
* ltmain.sh.in (link): If linking with $link_static_flag fails,
then retry without it, but still use the .a versions of
uninstalled libtool archives.

View File

@ -11,7 +11,6 @@ MAINTAINERCLEANFILES = ltconfig ltmain.sh
# Files in the demo subdirectory that go in the distribution.
demo_distfiles = Makefile.in Makefile.am README aclocal.m4 \
ansi2knr.1 ansi2knr.c \
configure configure.in foo.c foo.h hello.c main.c \
run.test

6
NEWS
View File

@ -1,3 +1,9 @@
New in 0.7a:
* Bug fixes, and more documentation.
* Basic support for other language compilers (C++, Fortran, and
preprocessed assembler).
* Support for *-*-irix5 and *-*-irix6*.
New in 0.7:
* Total rewrite of libtool, along with a new model for library building.
* Completely rewritten documentation for the new paradigm.

11
README
View File

@ -9,7 +9,18 @@ details.
Libtool supports building static libraries on all platforms.
Shared library support has been implemented for these platforms:
AIX 4.x (*-*-aix4*)
FreeBSD 2.x (*-*-freebsd*)
NetBSD 1.x (*-*-netbsd*)
Solaris 2.x (*-*-solaris2*)
Linux ELF targets (*-*-linux*, except *-*-linuxaout* and *-*-linuxoldld*)
All ELF targets that use both GCC and GNU ld
Shared library support is implemented, but untested on:
AIX 3.x (*-*-aix3*)
Digital/UNIX 3.x, a.k.a. OSF/1 (*-*-osf3*)
HP-UX 10.x (*-*-hpux10*)
Solaris 1.x, a.k.a. SunOS 4.x (*-*-sunos4*)
See the file NEWS for a description of recent changes to libtool.

26
TODO
View File

@ -1,13 +1,25 @@
* Implement `ld -r' on all platforms.
For 1.0:
* Don't forget to find link_static_flag for native cc's on HP-UX and OSF/1.
* Have people test libtool on AIX 3, OSF/1, HP-UX, and SunOS 4.
* Write installcheck for the demo directory.
* Don't forget to find link_static_flag for native cc's on HP-UX and
OSF/1.
* Implement fuller support for profiled libraries (libNAME_p), and
resolve naming difficulties for debuggable libraries (libNAME_g on
Linux at least), old system 5 shared libraries (libNAME_s), etc, maybe
based on cflags.
* Implement shared libraries and `-static' linking on platforms that
support them. Ones that stand out, which libtool doesn't support:
IRIX.
For 1.1:
* Implement full support for other basic library types (libhello_g,
libhello_p). Make these types configurable. Some thinking will have
to be done about the defaults, and what libhello (standard type)
should be.
Sometime in the future (maybe):
* Add support for windoze DLL's, and maybe old Linux jumptable
libraries. Check out Lesstif and Tcl configuration again.
* What should be done about the difference between -fpic and -fPIC?

View File

@ -1,5 +1,5 @@
AC_INIT(ltmain.sh.in)
AM_INIT_AUTOMAKE(libtool, 0.7a)
AM_INIT_AUTOMAKE(libtool, 0.7b)
pkgdatadir='${datadir}/libtool'
AC_SUBST(pkgdatadir)

View File

@ -3,22 +3,22 @@ AUTOMAKE_OPTIONS = ansi2knr foreign
EXTRA_DIST = $(TESTS) acinclude.m4
# Build a libtool library, libhell.la for installation in libdir.
lib_PROGRAMS = libhell.la
libhell_la_SOURCES = hello.c foo.c
libhell_la_LDFLAGS = -version-info 3:12:1 -rpath $(libdir)
# Build a libtool library, libhello.la for installation in libdir.
lib_PROGRAMS = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LDFLAGS = -version-info 3:12:1 -rpath $(libdir)
include_HEADERS = foo.h
bin_PROGRAMS = hell hell.static
# Build hell from main.c and libhell.la
# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhell.la
hell_LDADD = libhello.la
# Create a statically-linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhell.la
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = -static
TESTS = run.test

View File

@ -108,7 +108,7 @@ Introduction
Using Libtool
* Creating Object Files:: Compiling object files for libraries.
* Linking Libraries::
* Linking Libraries:: Creating libraries from object files.
* Linking Executables:: Linking object files against libtool libraries.
* Installing Libraries:: Making libraries available to users.
* Installing Executables:: Making programs available to users.
@ -131,9 +131,9 @@ Integrating Libtool with Your Own Packages
Configuring Libtool
* Invoking ltconfig::
* ltconfig Example::
* AM_PROG_LIBTOOL::
* Invoking ltconfig:: @file{ltconfig} command line options.
* ltconfig Example:: Manually configuring a @file{libtool}.
* AM_PROG_LIBTOOL:: Configuring @file{libtool} in @file{configure.in}.
Including Libtool with Your Package
@ -426,22 +426,34 @@ simply invoke libtool with the standard compilation command as an
argument:
@example
a23$ libtool gcc -g -O -c foo.c
gcc -g -O -c foo.c -o foo.lo
a23$ libtool gcc -g -O -c hello.c
gcc -g -O -c hello.c -o hello.lo
a23$ @kbd{libtool gcc -g -O -c foo.c}
gcc -g -O -c foo.c
ln -s foo.o foo.lo
a23$ @kbd{libtool gcc -g -O -c hello.c}
gcc -g -O -c hello.c
ln -s hello.o hello.lo
a23$
@end example
Note that libtool creates two object files for each invocation. The
`.lo' file is a library object, and the `.o' file is a standard object
file. On `a23', these files are identical, because only static
libraries are supported.
On shared library systems, libtool automatically inserts the PIC
generation flags into the compilation command:
generation flags into the compilation command, so that the library
object and the standard object differ:
@example
burger$ @kbd{libtool gcc -g -O -c foo.c}
gcc -g -O -c -fPIC -DPIC foo.c -o foo.lo
gcc -g -O -c -fPIC -DPIC foo.c
mv -f foo.o foo.lo
gcc -g -O -c foo.c
burger$ @kbd{libtool gcc -g -O -c hello.c}
gcc -g -O -c -fPIC -DPIC hello.c -o hello.lo
burger$
gcc -g -O -c -fPIC -DPIC hello.c
mv -f hello.o hello.lo
gcc -g -O -c hello.c
burger$
@end example
@node Linking Libraries, Linking Executables, Creating Object Files, Using Libtool
@ -477,16 +489,15 @@ the same ones you would use to produce an executable named
@example
burger$ @kbd{libtool gcc -g -O -o libhello.la foo.o hello.o}
libtool: cannot build libtool library `libhello.la' from non-libtool objects
libtool: cannot build libtool library `libhello.la' from non-libtool \
objects
burger$
@end example
Aha! Libtool caught a common error@dots{} trying to build a library
from standard objects instead of library objects.@footnote{The converse,
however, is perfectly legal. Library objects can do anything that
standard objects can do@dots{} it makes sense to link them directly into
programs.} This doesn't matter much for static libraries, but on shared
library systems, it is of great importance.
from standard objects instead of library objects. This doesn't matter
for static libraries, but on shared library systems, it is of great
importance.
So, let's try again, this time with the library object files:
@ -502,10 +513,11 @@ installed. So, we try again, with an @code{rpath} setting of
@file{/usr/local/lib}:
@example
a23$ @kbd{libtool gcc -g -O -o libhello.la foo.lo hello.lo -rpath /usr/local/lib}
mkdir LIBS
ar cru LIBS/libhello.a foo.lo hello.lo
ranlib LIBS/libhello.a
a23$ @kbd{libtool gcc -g -O -o libhello.la foo.lo hello.lo \
-rpath /usr/local/lib}
mkdir .libs
ar cru .libs/libhello.a foo.o hello.o
ranlib .libs/libhello.a
creating libhello.la
a23$
@end example
@ -513,11 +525,13 @@ a23$
Now, let's try the same trick on the shared library platform:
@example
burger$ @kbd{libtool gcc -g -O -o libhello.la foo.lo hello.lo -rpath /usr/local/lib}
mkdir LIBS
ld -Bshareable -o LIBS/libhello.so.0.0 foo.lo hello.lo
ar cru LIBS/libhello.a foo.lo hello.lo
ranlib LIBS/libhello.a
burger$ @kbd{libtool gcc -g -O -o libhello.la foo.lo hello.lo \
-rpath /usr/local/lib}
mkdir .libs
rm -f .libs/libhello.*
ld -Bshareable -o .libs/libhello.so.0.0 foo.lo hello.lo
ar cru .libs/libhello.a foo.o hello.o
ranlib .libs/libhello.a
creating libhello.la
burger$
@end example
@ -526,7 +540,7 @@ Now that's significantly cooler@dots{} libtool just ran an obscure
@file{ld} command to create a shared library, as well as the static
library.
Note how libtool creates extra files in the @file{LIBS} subdirectory,
Note how libtool creates extra files in the @file{.libs} subdirectory,
rather than the current directory. This feature is to make it easier to
clean up the build directory, and to help ensure that other programs
fail horribly if you accidentally forget to use libtool when you should.
@ -560,35 +574,38 @@ burger$ @kbd{gcc -g -O -o hell.old main.o libhello.a}
burger$
@end example
This is libtool's way:
Libtool's way is almost the same@footnote{However, you should never use
@samp{-L} or @samp{-l} flags to link against an uninstalled libtool
library. Just specify the relative path to the `.la' file, such as
@file{../intl/libintl.la}.}:
@example
a23$ @kbd{libtool gcc -g -O -o hell main.o libhello.la}
gcc -g -O -o hell main.o ./LIBS/libhello.a
gcc -g -O -o hell main.o ./.libs/libhello.a
a23$
@end example
That looks too simple to be true. All libtool did was transform
@file{libhello.la} to @file{./LIBS/libhello.a}, but remember that
@file{libhello.la} to @file{./.libs/libhello.a}, but remember that
`a23' has no shared libraries.
On `burger' the situation is different:
@example
burger$ @kbd{libtool gcc -g -O -o hell main.o libhello.la}
gcc -g -O -o LIBS/hell main.o -L./LIBS -R/usr/local/lib -lhello
gcc -g -O -o .libs/hell main.o -L./.libs -R/usr/local/lib -lhello
creating hell
burger$
@end example
Notice that the executable, @file{hell} was actually created in the
@file{LIBS} subdirectory. Then, a wrapper script was created in the
@file{.libs} subdirectory. Then, a wrapper script was created in the
current directory.
On NetBSD 1.2, libtool encodes the installation directory of
@file{libhello}, @file{/usr/local/lib}, by using the @code{-R} compiler
flag. Then, the wrapper script guarantees that the executable finds the
correct shared library (the one in @file{./LIBS}) until it is properly
correct shared library (the one in @file{./.libs}) until it is properly
installed.
Let's compare the two different programs:
@ -616,10 +633,10 @@ to yield?
burger$ @kbd{ls -l hell.old libhello.a}
-rwxr-xr-x 1 gord gord 15481 Nov 14 12:11 hell.old
-rw-r--r-- 1 gord gord 4274 Nov 13 18:02 libhello.a
burger$ @kbd{ls -l LIBS/hell LIBS/libhello.*}
-rwxr-xr-x 1 gord gord 11602 Nov 14 12:10 LIBS/hell
-rw-r--r-- 1 gord gord 4352 Nov 13 18:44 LIBS/libhello.a
-rwxr-xr-x 1 gord gord 12205 Nov 13 18:44 LIBS/libhello.so.0.0
burger$ @kbd{ls -l .libs/hell .libs/libhello.*}
-rwxr-xr-x 1 gord gord 11647 Nov 14 12:10 .libs/hell
-rw-r--r-- 1 gord gord 4274 Nov 13 18:44 .libs/libhello.a
-rwxr-xr-x 1 gord gord 12205 Nov 13 18:44 .libs/libhello.so.0.0
burger$
@end example
@ -659,9 +676,9 @@ Libtool installation is quite simple, as well. Just use the
@example
a23# @kbd{libtool cp libhello.la /usr/local/lib/libhello.la}
cp libhello.la /local/lib/libhello.la
cp LIBS/libhello.a /local/lib/libhello.a
ranlib /local/lib/libhello.a
cp libhello.la /usr/local/lib/libhello.la
cp .libs/libhello.a /usr/local/lib/libhello.a
ranlib /usr/local/lib/libhello.a
a23#
@end example
@ -671,10 +688,10 @@ informational purposes.
Here is the shared library example:
@example
burger# libtool install -c libhello.la /usr/local/lib/libhello.la
install -c LIBS/libhello.so.0.0 /usr/local/lib/libhello.so.0.0
burger# @kbd{libtool install -c libhello.la /usr/local/lib/libhello.la}
install -c .libs/libhello.so.0.0 /usr/local/lib/libhello.so.0.0
install -c libhello.la /usr/local/lib/libhello.la
install -c LIBS/libhello.a /usr/local/lib/libhello.a
install -c .libs/libhello.a /usr/local/lib/libhello.a
ranlib /usr/local/lib/libhello.a
burger#
@end example
@ -727,7 +744,7 @@ installs the correct binary:
@example
burger# libtool install -c hell /usr/local/bin/hell
install -c LIBS/hell /usr/local/bin/hell
install -c .libs/hell /usr/local/bin/hell
burger#
@end example
@ -758,7 +775,7 @@ Link the files in the same way you would a libtool library, but use a
@example
burger$ @kbd{libtool gcc -o libfoo.a main.o foo.lo hello.lo}
rm -f libfoo.a
ar cru libfoo.a main.o foo.lo hello.lo
ar cru libfoo.a main.o foo.o hello.o
ranlib libfoo.a
burger$
@end example
@ -897,14 +914,20 @@ If not specified, each of these variables defaults to 0
@end table
If the @var{output-file} ends in `.la', then a libtool library is
created, which must be build only from library objects (`.lo' files).
The @samp{-rpath} option is required. In the current implementation,
libtool libraries may not depend on other uninstalled libtool
libraries.
created, which must be built only from library objects (`.lo'
files)@footnote{Object files with a `.l_o' suffix are also accepted, to
help with Automake's @code{ansi2knr} support (@pxref{ANSI, , Automatic
de-ANSI-fication, automake.info, The Automake Manual}).} The
@samp{-rpath} option is required. In the current implementation,
libtool libraries may not depend on other uninstalled libtool libraries.
If the @var{output-file} ends in `.a', then a standard library is
created using @file{ar} and possibly @file{ranlib}.
If @var{output-file} ends in `.o' or `.lo', then a reloadable object
file is created from the input files (generally using @samp{ld -r}).
This method is called @dfn{incremental linking}.
Otherwise, an executable program is created.
@node Install Mode, Finish Mode, Link Mode, Invoking libtool
@ -1184,9 +1207,13 @@ and @samp{--disable-shared} @file{configure} flags.
When you invoke the @file{libtoolize} program (@pxref{Invoking
libtoolize}), it will tell you where to find a definition of
@file{AM_PROG_LIBTOOL}. If you use Automake, the @file{aclocal} program
will automatically add @file{AM_PROG_LIBTOOL} support to your
@file{configure} script.
@code{AM_PROG_LIBTOOL}. If you use Automake, the @file{aclocal} program
will automatically add @code{AM_PROG_LIBTOOL} support to your
@file{configure} script.@footnote{@code{AM_PROG_LIBTOOL} requires that
you define the Makefile variable @code{top_builddir} in your
@file{Makefile.in}. Automake does this automatically, but Autoconf
users should set it to the relative path to the top of your build
directory (@file{../..}, for example).}
@node Distributing, , Configuring, Integrating Libtool
@comment node-name, next, previous, up

View File

@ -3,7 +3,7 @@
# ltconfig - Create a system-specific libtool.
# When updating this script, search for LINENUM and fix line number refs.
# @configure_input@
# Copyright (C) 1996, Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, Free Software Foundation, Inc.
# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@ rm="rm -f"
help="Try \`$progname --help' for more information."
# Global variables:
can_build_shared=yes
enable_shared=yes
# All known linkers require a `.a' archive for static linking.
enable_static=yes
@ -374,6 +375,7 @@ compiler="$2"
echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
pic_flag=
profile_flag_pattern=
special_shlib_compile_flags=
wl=
link_static_flag=
@ -410,6 +412,12 @@ else
link_static_flag='-non_shared'
;;
*-*-sco3.2v5*)
pic_flag='-Kpic'
link_static_flag='-dn'
special_shlib_compile_flags='-belf'
;;
*-*-solaris2*)
pic_flag='-KPIC'
link_static_flag='-Bstatic'
@ -434,8 +442,6 @@ rs6000-*-* | powerpc-*-* | powerpcle-*-*)
;;
esac
# FIXME actually try compiling an object file with the pic flag?
if test -n "$pic_flag"; then
echo $ac_t "$pic_flag" 1>&6
pic_flag=" $pic_flag"
@ -443,6 +449,16 @@ else
echo $ac_t none 1>&6
fi
# Check for any special shared library compilation flags.
if test -n "$special_shlib_compile_flags"; then
echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
else
echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
can_build_shared=no
fi
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
@ -521,7 +537,7 @@ else
;;
*-*-irix5* | *-*-irix6*)
archive_cmds='$LD -shared -o $lib -soname $install_libdir/$soname -set_version $verstring$libobjs -lc$deplibs'
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
link_rpath_flag='${wl}-rpath ${wl}$libdir'
;;
@ -532,10 +548,14 @@ else
;;
*-*-osf3*)
archive_cmds='$LD -shared -o $lib -soname $install_libdir/$soname -set_version $verstring$libobjs -lc$deplibs'
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
link_rpath_flag='${wl}-rpath ${wl}$libdir'
;;
*-*-sco3.2v5*)
archive_cmds='$LD -G -o $lib$libobjs$deplibs'
;;
*-*-solaris2*)
archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs'
link_rpath_flag='-R$libdir'
@ -569,7 +589,6 @@ echo $ac_t "$reload_flag"
test -n "$reload_flag" && reload_flag=" $reload_flag"
# PORTME Fill in your ld.so characteristics
can_build_shared=yes
lib_names=
soname_spec=
postinstall_cmds=
@ -617,10 +636,10 @@ case "$host" in
postinstall_cmds='chmod 555 $lib'
;;
*-*-irix5*)
*-*-irix5* | *-*-irix6*)
version_type=osf
soname_spec='$libname.so.$major'
lib_names='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so'
lib_names='$libname.so.$versuffix $libname.so'
shlibpath_var=LD_LIBRARY_PATH
;;
@ -646,6 +665,13 @@ case "$host" in
;;
*-*-osf3*)
version_type=osf
soname_spec='$libname.so'
lib_names='$libname.so.$versuffix $libname.so'
shlibpath_var=LD_LIBRARY_PATH
;;
*-*-sco3.2v5*)
version_type=osf
soname_spec='$libname.so.$major'
lib_names='$libname.so.$versuffix $libname.so.$major $libname.so'

View File

@ -319,8 +319,9 @@ if test -z "$show_help"; then
-static)
build_libtool_libs=no
farg="$link_static_flag"
carg="$farg"
link_static="`eval echo \"$link_static_flag\"`"
carg="$link_static"
farg=
;;
-version-file)
@ -704,7 +705,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/ $//g'`
compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
fi
if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
@ -712,7 +713,17 @@ if test -z "$show_help"; then
compile_command=`echo "$compile_command" | sed "s%-o $objdir/%-o %"`
$show "$compile_command"
$run $compile_command
exit $?
status=$?
# If we failed to link statically, then try again.
if test $status -ne 0 && test -n "$link_static"; then
echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2
compile_command=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"`
$show "$compile_command"
$run $compile_command
status=$?
fi
exit $status
fi
# Create the binary in the object directory, then wrap it.

View File

@ -1,3 +1,19 @@
Sun Dec 8 14:43:15 1996 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* demo.test: Break up into demo-conf.test, demo-make.test,
demo-exec.test, demo-inst.test, and demo-unst.test, so that passes
and failures are reported more quickly.
* link-2.test: Test to make sure that .lo files don't get built
directly into programs.
Sat Dec 7 15:44:49 1996 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* tlibtool: A typically-configured libtool script, that uses
../ltmain.sh.in for its backend.
* link.test: Make sure that it is legal to link against .a files.
Mon Dec 2 16:31:10 1996 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* demo.test: Try compiling the ../demo subdirectory, with no

View File

@ -2,6 +2,7 @@
AUTOMAKE_OPTIONS = gnits
TESTS = demo.test test-e.test
TESTS = demo-conf.test demo-make.test demo-exec.test demo-inst.test \
demo-unst.test link.test link-2.test test-e.test
EXTRA_DIST = defs $(TESTS)
EXTRA_DIST = defs tlibtool $(TESTS)