* NEWS, TODO: updated (pic flags)

* libtool.m4 (AC_PROG_LIBTOOL): added --with-pic flag
* ltconfig.in: new pic_mode variable and --prefer[-non]-pic flags,
  fixed the strip check (reported by Keith Bostic <bostic@bostic.com>)
* ltmain.in (compile mode): build only PIC/non-PIC code depending
  on pic_mode
* libltdl/README: document the supported dlopen interfaces
* doc/libtool.texi (tests): documented new tests
* tests/Makefile.am: added new tests
* tests/demo-pic.test: new test to test --with-pic
* tests/demo-nopic.test: new test to test --without-pic
* tests/build-relink2.test: variant of build-relink.test that
  uses depdemo
This commit is contained in:
Thomas Tanner 1999-07-17 09:00:53 +00:00 committed by Thomas Tanner
parent 910e10d745
commit cbc1402596
12 changed files with 265 additions and 16 deletions

View File

@ -1,3 +1,19 @@
1999-07-17 Thomas Tanner <tanner@ffii.org>
* NEWS, TODO: updated (pic flags)
* libtool.m4 (AC_PROG_LIBTOOL): added --with-pic flag
* ltconfig.in: new pic_mode variable and --prefer[-non]-pic flags,
fixed the strip check (reported by Keith Bostic <bostic@bostic.com>)
* ltmain.in (compile mode): build only PIC/non-PIC code depending
on pic_mode
* libltdl/README: document the supported dlopen interfaces
* doc/libtool.texi (tests): documented new tests
* tests/Makefile.am: added new tests
* tests/demo-pic.test: new test to test --with-pic
* tests/demo-nopic.test: new test to test --without-pic
* tests/build-relink2.test: variant of build-relink.test that
uses depdemo
1999-07-09 Olly Betts <olly@muscat.co.uk>
* doc/libtool.texi (C++ Libraries): fixed a typo.

4
NEWS
View File

@ -1,5 +1,9 @@
NEWS - list of user-visible changes between releases of GNU Libtool
New in 1.3d: 1999-??-??; CVS version 1.3c, Libtool team:
* New --with-pic flag to control the generation of PIC/non-PIC code.
* Various bugfixes
New in 1.3b: 1999-07-02; CVS version 1.3a, Libtool team:
* Complete inter-library dependencies support. It's now possible
to link libtool libraries against other libtool libraries.

7
TODO
View File

@ -33,13 +33,6 @@ In the future:
possible would greatly improve libltdl's ability to be embedded in and
used by other systems.
* Pavel Roskin writes about --enable-pic-static:
Is it true that the objects which are suitable for building shared
libraries are always suitable for building static libraries? If yes,
would it be a good idea to have an option which would enable building
shared and static libraries from the same object files. 50% speedup is
worth considering IMHO.
* Support -dlopen/dlpreopen for libraries.
This requires adding two new variables (dlopen/dlpreopen) to
the pseudo-library and later dlopening them when a program is linked

View File

@ -3295,6 +3295,8 @@ shared libraries (@samp{--disable-static}).
@itemx demo-static.test
@itemx demo-shared.test
@itemx demo-nofast.test
@itemx demo-pic.test
@itemx demo-nopic.test
@pindex demo-conf.test
@pindex demo-exec.test
@pindex demo-inst.test
@ -3303,6 +3305,8 @@ shared libraries (@samp{--disable-static}).
@pindex demo-static.test
@pindex demo-shared.test
@pindex demo-nofast.test
@pindex demo-pic.test
@pindex demo-nopic.test
These programs check to see that the @file{demo} subdirectory of the
libtool distribution can be configured, built, installed, and
uninstalled correctly.
@ -3317,7 +3321,10 @@ libtool configurations: @file{demo-conf.test} configures
(@samp{--disable-shared}), and @file{demo-shared.test} builds only
shared libraries (@samp{--disable-static}).
@file{demo-nofast.test} configures @file{demo/libtool} to
disable the fast-install mode (@samp{--enable-fast-install=no}.
disable the fast-install mode (@samp{--enable-fast-install=no}).
@file{demo-pic.test} configures @file{demo/libtool} to
prefer building PIC code (@samp{--with-pic}), @file{demo-nopic.test}
to prefer non-PIC code (@samp{--without-pic}).
@item deplibs.test
@pindex deplibs.test

View File

@ -1 +1,9 @@
This is GNU libltdl, a system independent dlopen wrapper for GNU libtool.
It supports the following dlopen interfaces:
* dlopen (Solaris, Linux and various BSD flavors)
* shl_load (HP-UX)
* LoadLibrary (Win16 and Win32)
* load_add_on (BeOS)
* GNU DLD (emulates dynamic linking for static libraries)
* libtool's dlpreopen

8
libtool.m4 vendored
View File

@ -21,7 +21,7 @@
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
# serial 40 AC_PROG_LIBTOOL
# serial 41 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
@ -82,6 +82,12 @@ AC_ARG_ENABLE(libtool-lock,
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
AC_ARG_WITH(pic,
[ --with-pic try to use only PIC/non-PIC objects [default=use both]],
pic_mode="$withval", pic_mode=default)
test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$host" in

View File

@ -187,6 +187,7 @@ enable_static=yes
enable_fast_install=yes
enable_dlopen=unknown
enable_win32_dll=no
pic_mode=default
ltmain=
silent=
srcdir=
@ -257,6 +258,8 @@ Generate a system-specific libtool script.
--version output version information and exit
--with-gcc assume that the GNU C compiler will be used
--with-gnu-ld assume that the C compiler uses the GNU linker
--prefer-pic try to use only PIC objects
--prefer-non-pic try to use only non-PIC objects
--disable-lock disable file locking
--cache-file=FILE configure cache file
@ -298,6 +301,9 @@ EOM
--with-gcc) with_gcc=yes ;;
--with-gnu-ld) with_gnu_ld=yes ;;
--prefer-pic) pic_mode=yes ;;
--prefer-non-pic) pic_mode=no ;;
--disable-lock) need_locks=no ;;
--cache-file=*) cache_file="$optarg" ;;
@ -1669,7 +1675,7 @@ fi
echo "$ac_t$hardcode_action" 1>&6
echo $ac_n "checking whether stripping libraries is possible... $ac_c" 1>&6
if test -n "$STRIP" && $STRIP -V | grep "GNU strip" >/dev/null; then
if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
echo "${ac_t}yes" 1>&6
@ -2280,6 +2286,19 @@ elif test "$shlibpath_overrides_runpath" = yes ||
enable_fast_install=needless
fi
# Check whether we must set pic_mode to default
test -z "$pic_flag" && pic_mode=default
# On Cygwin there's no "real" PIC flag so we must build both object types
case "$host_os" in
cygwin* | mingw* | os2*)
pic_mode=default
;;
esac
if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
# non-PIC code in shared libraries is not supported
pic_mode=default
fi
if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
@ -2902,6 +2921,7 @@ exeext="$exeext"
# Additional compiler flags for building library objects.
pic_flag=$pic_flag
pic_mode=$pic_mode
# Does compiler simultaneously support -c and -o options?
compiler_c_o=$compiler_c_o

View File

@ -434,8 +434,13 @@ compiler."
# Without this assignment, base_compile gets emptied.
fbsd_hideous_sh_bug=$base_compile
# All platforms use -DPIC, to notify preprocessed assembler code.
command="$base_compile $pic_flag -DPIC $srcfile"
if test "$pic_mode" != no; then
# All platforms use -DPIC, to notify preprocessed assembler code.
command="$base_compile $pic_flag -DPIC $srcfile"
else
# Don't build PIC code
command="$base_compile $srcfile"
fi
if test "$build_old_libs" = yes; then
lo_libobj="$libobj"
dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
@ -506,7 +511,8 @@ compiler."
fi
# If we have no pic_flag, then copy the object into place and finish.
if test -z "$pic_flag" && test "$build_old_libs" = yes; then
if (test -z "$pic_flag" || test "$pic_mode" != default) &&
test "$build_old_libs" = yes; then
# Rename the .lo from within objdir to obj
if test -f $obj; then
$show $rm $obj
@ -538,7 +544,13 @@ compiler."
# Only build a position-dependent object if we build old libraries.
if test "$build_old_libs" = yes; then
command="$base_compile $srcfile"
if test "$pic_mode" != yes; then
# Don't build PIC code
command="$base_compile $srcfile"
else
# All platforms use -DPIC, to notify preprocessed assembler code.
command="$base_compile $pic_flag -DPIC $srcfile"
fi
if test "$compiler_c_o" = yes; then
command="$command -o $obj"
output_obj="$obj"
@ -2613,7 +2625,7 @@ EOF
exit 0
fi
if test -n "$pic_flag"; then
if test -n "$pic_flag" || test "$pic_mode" != default; then
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs $reload_conv_objs"
output="$libobj"

View File

@ -18,13 +18,15 @@ TESTS = cdemo-static.test cdemo-make.test cdemo-exec.test \
mdemo-inst.test mdemo-unst.test dryrun.test \
demo-nofast.test demo-make.test demo-exec.test \
demo-inst.test demo-unst.test \
demo-pic.test demo-make.test demo-exec.test \
demo-nopic.test demo-make.test demo-exec.test \
depdemo-nofast.test depdemo-make.test depdemo-exec.test \
depdemo-inst.test depdemo-unst.test \
cdemo-shared.test cdemo-make.test cdemo-exec.test \
demo-shared.test demo-make.test demo-exec.test demo-inst.test \
hardcode.test build-relink.test noinst-link.test demo-unst.test \
depdemo-shared.test depdemo-make.test depdemo-exec.test \
depdemo-inst.test depdemo-unst.test \
depdemo-inst.test build-relink2.test depdemo-unst.test \
mdemo-shared.test mdemo-make.test mdemo-exec.test \
mdemo-inst.test mdemo-unst.test \
assign.test link.test link-2.test nomode.test \

121
tests/build-relink2.test Executable file
View File

@ -0,0 +1,121 @@
#! /bin/sh
# build-relink2.test - check to see whether shlibpath overrides runpath
# Test script header.
need_prefix=yes
if test -z "$srcdir"; then
srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
test "$srcdir" = "$0" && srcdir=.
test "${VERBOSE+set}" != "set" && VERBOSE=yes
fi
. $srcdir/defs || exit 1
# Check that things are built.
if test -f $prefix/lib/extra/libl3.la && cd ../depdemo && test -f l3/libl3.la; then :
else
echo "You must run depdemo-inst.test before $0" 1>&2
exit 77
fi
# Check to make sure we have a dynamic library.
library_names=NONE
eval `egrep -e '^library_names=' ./l3/libl3.la 2>/dev/null`
if test "$library_names" = NONE; then
echo "library_names not set in ../depdemo/l3/libl3.la" 1>&2
exit 1
elif test -z "$library_names"; then
echo "= Exiting: ../depdemo/l3/libl3.la is not a shared library"
exit 77
fi
# Unfortunately, we need access to libtool internals for this test.
objdir=NONE
eval `egrep -e '^objdir=' ./libtool 2>/dev/null`
if test "$objdir" = NONE; then
echo "objdir not set in ../depdemo/libtool" 1>&2
exit 1
fi
shlibpath_overrides_runpath=NONE
eval `egrep -e '^shlibpath_overrides_runpath=' ./libtool 2>/dev/null`
if test "$shlibpath_overrides_runpath" = NONE; then
echo "shlibpath_overrides_runpath not set in ../depdemo/libtool" 1>&2
exit 1
fi
hardcode_action=NONE
eval `egrep -e '^hardcode_action=' ./libtool 2>/dev/null`
if test "$hardcode_action" = NONE; then
echo "hardcode_action not set in ../depdemo/libtool" 1>&2
exit 1
fi
hardcode_direct=NONE
eval `egrep -e '^hardcode_direct=' ./libtool 2>/dev/null`
if test "$hardcode_direct" = NONE; then
echo "hardcode_direct not set in ../depdemo/libtool" 1>&2
exit 1
fi
hardcode_into_libs=NONE
eval `egrep -e '^hardcode_into_libs=' ./libtool 2>/dev/null`
if test "$hardcode_into_libs" = NONE; then
echo "hardcode_into_libs not set in ../depdemo/libtool" 1>&2
exit 1
fi
./depdemo # so that it links on-demand if needed
echo "removing libl3.la from ../depdemo/l3"
rm -rf l3/libl3.la l3/$objdir
echo "running ../depdemo/depdemo"
if ./depdemo; then
:
elif test "x,$hardcode_action,$hardcode_direct" = x,relink,yes; then
echo "Ok, uninstalled programs fail after uninstalled libraries are removed"
echo "This works in other configurations, but not in this particular one"
else
echo "= Exiting: ../depdemo/depdemo does not run, maybe libl3 was not installed"
exit 1
fi
echo "linking a broken ../depdemo/l3/libl3.la"
if (cd l3; $make libl3.la libl3_la_OBJECTS=../l2/l2.lo); then
:
else
echo "= Exiting: cannot link broken libl3.la"
exit 1
fi
rm -f l3/libl3.la
echo "running ../depdemo/depdemo with broken libl3.la"
if (./depdemo) 2>&1; then
echo "= Exiting: ../depdemo/depdemo runs even though libl3.la is incomplete"
echo "shlibpath_overrides_runpath should be set to no"
exit 1
else
echo "Failed, as expected"
fi
if test "x$hardcode_action" = xrelink ||
test "x$hardcode_into_libs" = xyes; then
echo "= Exiting: install-time relinking is required"
exit 0
fi
if test "$shlibpath_overrides_runpath" != yes; then
rm -f $objdir/lt-depdemo || exit 1
cp $objdir/depdemo $objdir/lt-depdemo || exit 1
echo "running ../depdemo/depdemo with installed libl3.la"
if ./depdemo; then
echo "Worked, as expected"
else
echo "shlibpath_overrides_runpath should be set to yes"
status=1
fi
rm -f $objdir/lt-depdemo
fi
exit $status

30
tests/demo-nopic.test Executable file
View File

@ -0,0 +1,30 @@
#! /bin/sh
# demo-nopic.test - try configuring the ../demo subdirectory
# Test script header.
need_prefix=no
if test -z "$srcdir"; then
srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
test "$srcdir" = "$0" && srcdir=.
test "${VERBOSE+set}" != "set" && VERBOSE=yes
fi
. $srcdir/defs || exit 1
# Maybe we have a VPATH build, in which case, create a new subdir.
test -d ../demo || mkdir ../demo
# Change to our build directory.
cd ../demo || exit 1
# Possibly clean up the distribution.
if test -f Makefile; then
echo "= Running $make distclean in ../demo"
$make distclean
fi
rm -f config.cache
# Configure the demonstration.
echo "= Configuring in ../demo (prefix=$prefix) with --without-pic"
CONFIG_SITE=/dev/null ${CONFIG_SHELL-/bin/sh} $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix --with-pic=no || exit 1
exit 0

30
tests/demo-pic.test Executable file
View File

@ -0,0 +1,30 @@
#! /bin/sh
# demo-pic.test - try configuring the ../demo subdirectory
# Test script header.
need_prefix=no
if test -z "$srcdir"; then
srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
test "$srcdir" = "$0" && srcdir=.
test "${VERBOSE+set}" != "set" && VERBOSE=yes
fi
. $srcdir/defs || exit 1
# Maybe we have a VPATH build, in which case, create a new subdir.
test -d ../demo || mkdir ../demo
# Change to our build directory.
cd ../demo || exit 1
# Possibly clean up the distribution.
if test -f Makefile; then
echo "= Running $make distclean in ../demo"
$make distclean
fi
rm -f config.cache
# Configure the demonstration.
echo "= Configuring in ../demo (prefix=$prefix) with --with-pic"
CONFIG_SITE=/dev/null ${CONFIG_SHELL-/bin/sh} $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix --with-pic=yes || exit 1
exit 0