@item
The install @file{Makefile} target should warn the package installer to set
-@var{LD_LIBRARY_PATH} (or equivalent) or run @code{ldconfig(8)}, if
-required.
+the proper environment variables (@var{LD_LIBRARY_PATH} or equivalent),
+or run @code{ldconfig(8)}.
@end enumerate
@node Other implementations
@section A postmortem analysis of other implementations
@cindex Other implementations, flaws in
-@cindex Reuseability of library systems
+@cindex Reusability of library systems
In all fairness, each of the implementations that I examined do the job
that they were intended to do, for a number of different host systems.
However, none of these solutions seem to function well as a generalized,
-reuseable component.
+reusable component.
@cindex Complexity of library systems
Most were too complex for me to use (much less modify) without
@end table
You can follow these examples on your own platform, using the
-pre-configured libtool script that was installed with libtool
+preconfigured libtool script that was installed with libtool
(@pxref{Configuring}).
Source files for the following examples are taken from the @file{demo}
Shared libraries, however, may only be built from
@dfn{position-independent code} (PIC). So, special flags must be passed
to the compiler to tell it to generate PIC rather than the standard
-position-dependant code.
+position-dependent code.
@cindex Library object file
@cindex @samp{.lo} files
@cindex Static linking
@cindex Convenience libraries
-Sometimes it is desirable to create a static archive that can never be
-shared. The most frequent case is when you have a ``convenience
-library'' that is a collection of related object files without a really
-nice interface.
-
-@c FIXME: we should update this section
Why return to @code{ar} and @code{ranlib} silliness when you've had a
-taste of libtool? libtool works consistently with standard object
-files, static libraries, and programs created without libtool's help.
-
-So, to create a static library:
-
-@enumerate 1
-@item
-Compile the object files with or without libtool. It doesn't matter
-whether these objects are PIC (end with the @samp{.lo} suffix) or not.
-
-@item
-Link the files in the same way you would a libtool library, but use a
-@samp{.a} suffix (instead of @samp{.la}):
+taste of libtool? Well, sometimes it is desirable to create a static
+archive that can never be shared. The most frequent case is when you
+have a ``convenience library'' that is a collection of related object
+files without a really nice interface.
-@example
-burger$ @kbd{libtool gcc -o libhello.a main.o foo.lo hello.lo -lm}
-rm -f libhello.a
-ar cru libhello.a main.o foo.o hello.o
-ranlib libhello.a
-burger$
-@end example
+To do this, you should ignore libtool entirely, and just use the old
+@code{ar} and @code{ranlib} commands to create a static library.
-@item
If you want to install the library (but you probably don't), then you
-can use libtool to do it, too:
+may use libtool if you want:
@example
burger$ @kbd{libtool ./install-sh -c libhello.a /local/lib/libhello.a}
ranlib /local/lib/libhello.a
burger$
@end example
-@end enumerate
+
+Using libtool for static library installation protects your library from
+being accidentally stripped (if the installer used the @samp{-s} flag),
+as well as automatically running the correct @code{ranlib} command.
@cindex Standalone binaries
Another common situation where static linking is desirable is in
The first @var{mode-arg} is the name of the program to use to delete
files (typically @file{/bin/rm}).
-The remaning @var{mode-args} are either flags for the deletion program
+The remaining @var{mode-args} are either flags for the deletion program
(beginning with a `-'), or the names of files to delete.
@node Integrating libtool
@cindex Makefile.am
@cindex Makefile.in
-Libtool is fully integrated with Automake (@pxref{Top,,, automake, The
-Automake Manual}), starting with Automake version 1.2.
+Libtool is fully integrated with Automake (@pxref{Top,, Introduction,
+automake, The Automake Manual}), starting with Automake version 1.2.
If you want to use libtool in a regular @file{Makefile} (or
@file{Makefile.in}), you are on your own. If you're not using Automake
@item
Compiling and linking a program against a shared library, which is
resolved automatically at run time by the dynamic linker. In this
-process, dynamic linking is transparant to the application.
+process, dynamic linking is transparent to the application.
@item
The application calling functions such as
This restriction simplifies the implementation of the @code{dlopen(3)}
family of functions by avoiding symbol relocation. ``True'' dlopen
implementations, such as the unportable GNU DLD 3 implementation
-(@pxref{Top,,, dld, The DLD Manual}), don't have this restriction, as
-they can perform relocation at runtime.
+(@pxref{Top,, Introduction, dld, The DLD Manual}), don't have this
+restriction, as they can perform relocation at runtime.
As of version @value{VERSION}, libtool provides only minimal support for
dlopened modules, and this support is guaranteed to change and be
Then, you should read the Emacs guide to reporting bugs (@pxref{Bugs, ,
Reporting Bugs, emacs, The Emacs Manual}). Some of the details
-listed there are specific to Emacs, but the priciple behind them is a
+listed there are specific to Emacs, but the principle behind them is a
general one.
Finally, send a bug report to @value{BUGADDR} with any appropriate
hppa1.1-hp-hpux10.10 cc 0.8 ok
i386-unknown-freebsd2.1.5 gcc 0.5 ok
i386-unknown-gnu0.0 gcc 0.5 ok
-i386-unknown-netbsd1.2 gcc 0.9f ok
-i586-unknown-linux1.3.20 gcc 0.9 ok
-i586-unknown-linux2.0.16 gcc 0.9f ok
+i386-unknown-netbsd1.2 gcc 0.9g ok
+i586-pc-linux-gnu1.3.20 gcc 0.9 ok
+i586-pc-linux-gnu2.0.16 gcc 0.9g ok
mips-sgi-irix5.3 cc 0.8 ok
mips-sgi-irix5.3 gcc 0.8 ok
mips-sgi-irix6.2 cc -32 0.9 ok
mips-sgi-irix6.2 cc -n32 0.9 ok
-powerpc-ibm-aix4.1.4.0 xlc 0.9d ok
-powerpc-ibm-aix4.1.4.0 gcc 0.9a ok
+powerpc-ibm-aix4.1.4.0 xlc 0.9g ok
+powerpc-ibm-aix4.1.4.0 gcc 0.9g ok
rs6000-ibm-aix3.2.5 xlc 0.9e ok
rs6000-ibm-aix3.2.5 gcc 0.9e ok*
-rs6000-ibm-aix4.1.4.0 xlc 0.9f ok
+rs6000-ibm-aix4.1.4.0 xlc 0.9g ok
rs6000-ibm-aix4.1.4.0 gcc 0.9e ok
sparc-sun-linux2.1.23 gcc 0.9 ok
sparc-sun-sunos4.1.3_U1 cc 0.9 ok
sparc-sun-solaris2.4 cc 0.9 ok
sparc-sun-solaris2.4 gcc 0.9 ok
sparc-sun-solaris2.5 cc 0.9 ok
-sparc-sun-solaris2.5 gcc 0.9f ok
+sparc-sun-solaris2.5 gcc 0.9g ok
--------------------------------------------------------
* Libtool will not build shared libraries because of a bug in
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
$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
$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 $?
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
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$//'`
# See if we need to build an old-fashioned archive.
if test "$build_old_libs" = "yes"; then
# Now set the variables for building old libraries.
- case "$output" in
- *.a) oldlib="$output" ;;
- *) oldlib="$objdir/$libname.a" ;;
- esac
+ oldlib="$objdir/$libname.a"
# Transform .lo files to .o files.
oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`