Fri Sep 5 13:11:38 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
+ * demo/Makefile.am (hell_debug_LDFLAGS): Change hell.static to
+ hell.debug in order to reflect the new static linking semantics.
+
+ * ltmain.sh.in (link): Add new `-all-static' flag to prevent all
+ dynamic linking. The old `-static' flag just prevents dynamic
+ linking against libtool libraries. Suggested by Bengt
+ Martensson.
+
* ltconfig.in (with_gnu_ld): Add a test to make sure that we are
actually using GNU ld. This fixes an inconsistency when running
ltconfig without using libtool.m4. Reported by Ulrich Drepper.
+ (global_symbol_pipe): Delete symbols that are not valid C
+ identifiers. Reported by Johan Danielsson and Bengt Martensson.
Thu Sep 4 21:53:08 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* ltmain.sh.in (echo): Quote all the uses of `echo' in all eval
- statements.
+ statements. Reported by Bengt Martensson and Alexandre Oliva.
+ (echo): Need to surround test args with double quotes, or the echo
+ test fails on Digital Unix 4.0. From Todd Kover.
Thu Aug 28 20:58:56 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
NEWS - list of user-visible changes between releases of GNU libtool.
-New in 1.0b:
+New in 1.0c:
* Bug fixes.
+* New `-all-static' flag to prevent any dynamic linking. The regular
+ `-static' flag just prevents dynamic linking of libtool libraries.
* Suppress duplicate compiler output during `compile' mode.
* New `execute' mode to support debugging uninstalled libtool
libraries and executables.
If ltconfig on your system says that it found the command to parse NM
output, then you don't need to look any further:
-checking command to parse NM output... yes
+checking command to parse /usr/bin/nm output... yes
Otherwise, I would very much appreciate hearing about the combination
of `NM' and `global_symbol_pipe' that ltconfig needs to use in order
So, on most OSes, this will be a command like:
$ nm assert-perr.o | \
- sed -e '/^.* [BCDEGRSTU] /!d' -e 's/^.* [BCDEGRSTU] \(.*\)$/\1 \1/'
+ sed -e '/^.* [BCDEGRSTU] \([_A-Za-z][_A-Za-z0-9]*\)$/!d'
+ -e 's/^.* [BCDEGRSTU] \([_A-Za-z][_A-Za-z0-9]*\)$/\1 \1/'
_IO_stderr_ _IO_stderr_
__assert_perror_fail __assert_perror_fail
__assert_program_name __assert_program_name
On some OSes, the C symbols will need to strip a leading underscore:
+$ nm assert-perr.o | \
+ sed -e '/^.* [BCDEGRSTU] _\([_A-Za-z][_A-Za-z0-9]*\)$/!d'
+ -e 's/^.* [BCDEGRSTU] _\([_A-Za-z][_A-Za-z0-9]*\)$/_\1 \1/'
__IO_stderr_ _IO_stderr_
___assert_perror_fail __assert_perror_fail
___assert_program_name __assert_program_name
For next public release:
************************
-* #@%$ing SUN makes their Solaris /usr/bin/echo always interpret
-backslashes, so:
- var='\n'
- newvar=`echo "$var"`
- test "$var" = "$newvar"
-returns false. We need to detect this, and use the other
-echo (/usr/ucb/echo).
-
* Document `execute' mode, and the experimental nature of -dlopen and
-dlpreopen.
dnl Process this file with autoconf to create configure.
AC_INIT(ltmain.sh.in)
-AM_INIT_AUTOMAKE(libtool,1.0b)
+AM_INIT_AUTOMAKE(libtool,1.0c)
pkgdatadir='${datadir}/libtool'
AC_SUBST(pkgdatadir)
include_HEADERS = foo.h
-bin_PROGRAMS = hell hell.static helldl
+bin_PROGRAMS = hell hell.debug helldl
# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la
-# Create a statically-linked version of hell.
-hell_static_SOURCES = main.c
-hell_static_LDADD = libhello.la
-hell_static_LDFLAGS = -static
+# Create an easier-to-debug version of hell.
+hell_debug_SOURCES = main.c
+hell_debug_LDADD = libhello.la
+hell_debug_LDFLAGS = -static
# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
@cindex Standalone binaries
Another common situation where static linking is desirable is in
creating a standalone binary. Use libtool to do the linking and add the
-@samp{-static} flag.
+@samp{-all-static} flag.
@node Invoking libtool
@chapter Invoking @code{libtool}
@table @samp
@cindex Undefined symbols, allowing
@cindex Unresolved symbols, allowing
+@item -all-static
+If @var{output-file} is a program, then do not link it against any
+shared libraries at all. If @var{output-file} is a library, then only
+create a static library.
+
@item -allow-undefined
If @var{output-file} is a libtool library, allow it to contain
references to symbols that aren't defined in that library or its
@item -static
If @var{output-file} is a program, then do not link it against any
-shared libraries. If @var{output-file} is a library, then only create a
-static library.
+uninstalled shared libtool libraries. If @var{output-file} is a
+library, then only create a static library.
@item -version-info @var{current}[:@var{revision}[:@var{age}]]
If @var{output-file} is a libtool library, use library version
@samp{program_LDADD} variable:
@example
-bin_PROGRAMS = hell hell.static
+bin_PROGRAMS = hell hell.debug
# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la
-# Create a statically-linked version of hell.
-hell_static_SOURCES = main.c
-hell_static_LDADD = libhello.la
-hell_static_LDFLAGS = -static
+# Create an easier-to-debug version of hell.
+hell_debug_SOURCES = main.c
+hell_debug_LDADD = libhello.la
+hell_debug_LDFLAGS = -static
@end example
You may use the @samp{program_LDFLAGS} variable to stuff in any flags
you want to pass to libtool while linking @samp{program} (such as
-@samp{-static} to create a statically-linked executable).
+@samp{-static} to avoid linking uninstalled shared libtool libraries).
Building a libtool library is almost as trivial@dots{} note the use of
@samp{libhello_la_LDFLAGS} to pass the @samp{-version-info}
# Check for command to grab the raw symbol name followed by C symbol from nm.
echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
-# This is a sane default that works on at least a few old systems.
-# [It comes from Ultrix. What could be older than Ultrix?!! ;)]
-global_symbol_pipe="sed -e '/^.* [BCDEGRSTU] /!d' -e 's/^.* [BCDEGRSTU] \(.*\)$/\1 \1/'"
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
-# Take a first stab at what the pipe should be.
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRSTU]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \1'
+
+# Define system-specific variables.
+case "$host_os" in
+aix*)
+ symcode='[BCDTU]'
+ ;;
+solaris2*)
+ symcode='[BDTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
- # We're using GNU nm.
- global_symbol_pipe="sed -e '/^.* [ABCDGISTU] /!d' -e 's/^.* [ABCDGISTU] \(.*\)$/\1 \1/'"
-else
- # It's the system nm.
- case "$host_os" in
- aix*)
- # Delete symbols that begin with a dot.
- global_symbol_pipe="sed -e '/^.* [BCDTU] [^.]/!d' -e 's/^.* [BCDTU] \(.*\)$/\1 \1/'"
- ;;
- solaris2*)
- global_symbol_pipe="sed -e '/^.* [BDTU] /!d' -e 's/^.* [BDTU] \(.*\)$/\1 \1/'"
- ;;
- esac
+ symcode='[ABCDGISTU]'
fi
+# Delete symbols that are not valid C identifiers.
+global_symbol_pipe="sed -e '/^.* $symcode $sympat$/!d'"
+
+# Write the raw and C identifiers.
+global_symbol_pipe="$global_symbol_pipe -e 's/^.* $symcode $sympat$/$symxfrm/'"
+
# Check to see that the pipe works correctly.
pipe_works=no
$rm conftest*
# the same distribution terms that you use for the rest of that program.
echo=echo
-if test X`$echo '\t'` = 'X\t'; then :
+if test "X`$echo '\t'`" = 'X\t'; then :
else
# The Solaris and AIX default echo program unquotes backslashes.
# This makes it impossible to quote backslashes using
install_libdir=
libobjs=
link_against_libtool_libs=
- link_static=
ltlibs=
objs=
prev=
for arg
do
case "$arg" in
- -static)
- if test "$build_libtool_libs" = yes; then
- if test "$hardcode_direct" = unsupported && test -z "$link_static_flag"; then
- $echo "$progname: warning: static linking is impossible in this configuration" 1>&2
- else
- build_libtool_libs=no
- fi
+ -all-static | -static)
+ if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$progname: warning: complete static linking is impossible in this configuration" 1>&2
fi
+ build_libtool_libs=no
build_old_libs=yes
break
;;
prevarg="$arg"
case "$arg" in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
-allow-undefined)
allow_undefined=yes
continue
-export-dynamic)
if test "$export_dynamic" != yes; then
export_dynamic=yes
- arg=`eval \$echo "$export_dynamic_flag_spec"`
+ arg=`eval \\$echo "$export_dynamic_flag_spec"`
# Add the symbol object into the linking commands.
compile_command="$compile_command @SYMFILE@"
;;
-static)
- link_static="$link_static_flag"
- compile_command="$compile_command $link_static"
- finalize_command="$finalize_command $link_static"
+ # We already handled this flag above.
continue
- ;;
+ ;;
-version-info)
prev=vinfo
fi
if test -n "$libdir"; then
- flag=`eval \$echo \"$hardcode_libdir_flag_spec\"`
+ flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
compile_command="$compile_command $flag"
finalize_command="$finalize_command $flag"
if test "$build_libtool_libs" = yes; then
# Get the real and link names of the library.
- library_names=`eval \$echo \"$library_names_spec\"`
+ library_names=`eval \\$echo \"$library_names_spec\"`
set dummy $library_names
realname="$2"
shift; shift
if test -n "$soname_spec"; then
- soname=`eval \$echo \"$soname_spec\"`
+ soname=`eval \\$echo \"$soname_spec\"`
else
soname="$realname"
fi
test -z "$pic_flag" && libobjs=`$echo "$libobjs " | sed -e 's/\.lo /.o /g' -e 's/ $//g'`
# Do each of the archive commands.
- cmds=`eval \$echo \"$archive_cmds\"`
+ cmds=`eval \\$echo \"$archive_cmds\"`
IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
for cmd in $cmds; do
IFS="$save_ifs"
reload_objs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
output="$obj"
- cmds=`eval \$echo \"$reload_cmds\"`
+ cmds=`eval \\$echo \"$reload_cmds\"`
IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
for cmd in $cmds; do
IFS="$save_ifs"
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs"
output="$libobj"
- cmds=`eval \$echo \"$reload_cmds\"`
+ cmds=`eval \\$echo \"$reload_cmds\"`
IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
for cmd in $cmds; do
IFS="$save_ifs"
# We have no uninstalled library dependencies, so finalize right now.
$show "$compile_command"
$run eval "$compile_command"
- 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 -e "s% $link_static % %" -e 's/ $//'`
- $show "$compile_command"
- $run eval "$compile_command"
- status=$?
- fi
- exit $status
+ exit $?
fi
# Replace the output file specification.
fi
# Do each command in the archive commands.
- cmds=`eval \$echo \"$old_archive_cmds\"`
+ cmds=`eval \\$echo \"$old_archive_cmds\"`
IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
for cmd in $cmds; do
IFS="$save_ifs"
# Do each command in the postinstall commands.
lib="$destdir/$realname"
- cmds=`eval \$echo \"$postinstall_cmds\"`
+ cmds=`eval \\$echo \"$postinstall_cmds\"`
IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
for cmd in $cmds; do
IFS="$save_ifs"
fi
# Do each command in the postinstall commands.
- cmds=`eval \$echo \"$old_postinstall_cmds\"`
+ cmds=`eval \\$echo \"$old_postinstall_cmds\"`
IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
for cmd in $cmds; do
IFS="$save_ifs"
for libdir in $libdirs; do
# Do each command in the postinstall commands.
- cmds=`eval \$echo \"$finish_cmds\"`
+ cmds=`eval \\$echo \"$finish_cmds\"`
IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
for cmd in $cmds; do
IFS="$save_ifs"
The following components of LINK-COMMAND are treated specially:
+ -all-static do not do any dynamic linking at all
-allow-undefined allow a libtool library to reference undefined symbols
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
-dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
-lNAME OUTPUT-FILE requires the installed library libNAME
-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
+ -static do not do any dynamic linking of libtool libraries
-version-info CURRENT[:REVISION[:AGE]]
specify library version info [each variable defaults to 0]
+Fri Sep 5 13:36:24 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
+
+ * demo-exec.test, demo-inst.test: Change references from
+ hell.static to hell.debug.
+
+ * quote.test (echo): Add the same Digital Unix echo test fixes as
+ the ones to ltmain.sh.in from Todd Kover.
+
+ * if.test, test-e.test (scripts): Add ../lineno to the scripts we
+ check.
+ * if.test: Check for accidental use of test X$something rather
+ than test "X$something".
+
Thu Aug 28 20:58:30 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* quote.test (echo): Change test to version that uses printf.
echo "Executing uninstalled programs in ../demo"
status=0
-if ../demo/hell.static | grep 'Welcome to GNU Hell'; then :
+if ../demo/hell.debug| grep 'Welcome to GNU Hell'; then :
else
- echo "$0: cannot execute ../demo/hell.static" 1>&2
+ echo "$0: cannot execute ../demo/hell.debug" 1>&2
status=1
fi
echo "= Executing installed programs"
status=0
-if $prefix/bin/hell.static | grep 'Welcome to GNU Hell'; then :
+if $prefix/bin/hell.debug | grep 'Welcome to GNU Hell'; then :
else
- echo "$0: cannot execute $prefix/bin/hell.static" 1>&2
+ echo "$0: cannot execute $prefix/bin/hell.debug" 1>&2
status=1
fi
fi
. $srcdir/defs || exit 1
-# Check for bad binary operators.
+# Check all the "portable" shell scripts.
status=0
-if egrep -n -e "if[ ]+[\"']?\\$.*(=|-[lg][te]|-eq|-ne)" $srcdir/../ltconfig $srcdir/../ltmain.sh; then
+scripts="$srcdir/../ltconfig $srcdir/../ltmain.sh $srcdir/../lineno"
+
+# Check for bad binary operators.
+if egrep -n -e "if[ ]+[\"']?\\$.*(=|-[lg][te]|-eq|-ne)" $scripts; then
echo "use \`if test \$something =' instead of \`if \$something ='"
status=1
fi
# Check for bad unary operators.
-if egrep -n -e 'if[ ]+-' $srcdir/../ltconfig $srcdir/../ltmain.sh; then
+if egrep -n -e 'if[ ]+-' $scripts; then
echo "use \`if test -X' instead of \`if -X'"
status=1
fi
# Check for using `[' instead of `test'.
-if egrep -n -e 'if[ ]+\[' $srcdir/../ltconfig $srcdir/../ltmain.sh; then
+if egrep -n -e 'if[ ]+\[' $scripts; then
echo "use \`if test' instead of \`if ['"
status=1
fi
+# Check for using test X... instead of test "X...
+if egrep -n -e 'test[ ]+X' $scripts; then
+ echo "use \`test "X..."' instead of \`test X'"
+ status=1
+fi
+
exit $status
status=0
echo=echo
-if test X`$echo '\t'` = 'X\t'; then :
+if test "X`$echo '\t'`" = 'X\t'; then :
else
# The Solaris and AIX default echo program unquotes backslashes.
# This makes it impossible to quote backslashes using
# echo "$something" | sed 's/\\/\\\\/g'
# So, we emulate echo with printf '%s\n'
echo='printf %s\n'
- if test X`$echo '\t'` = 'X\t'; then :
+ if test "X`$echo '\t'`" = 'X\t'; then :
else
# Oops. We have no working printf. Try to find a not-so-buggy echo.
echo=echo
. $srcdir/defs || exit 1
# Check that test -e isn't used in our portable shell scripts.
-if egrep -n -e 'test[ ]+-e' $srcdir/../ltconfig $srcdir/../ltmain.sh; then
+scripts="$srcdir/../ltconfig $srcdir/../ltmain.sh $srcdir/../lineno"
+if egrep -n -e 'test[ ]+-e' $scripts; then
echo "use test -f, not test -e to check for file existence"
exit 1
fi