diff --git a/ChangeLog b/ChangeLog index ce25d705..69302e55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,50 @@ +Tue Apr 1 10:01:20 1997 Gordon Matzigkeit + + * libtool.scm: Initial Guile implementation of libtool. + + * ltmain.sh.in: An unexpected inconsistency in my whole approach + to shared libraries has proven that libtool needs to be completely + rewritten if I'm going to give full shared library support for + platforms that don't use the GNU C library version 2 (which to my + knowledge currently only works on GNU Hurd and Linux/GNU systems). + Porting the GNU C library should not be difficult, though. + + Platforms that don't have the dlopen(3) family of functions will + need to install GNU DLD version 4 in order to build any kind of + libraries at all. Unfortunately, DLD 4 won't be released for a + while, because I maintain it, and I'm too busy working on libtool. + + I'll keep the old ltconfig/ltmain.sh implementation around for as + long as I can, and continue applying bug fixes, so that I'll have + a reasonable starting point for this new libtool implementation. + + It looks like this implementation will be even more complex than + the original (pre-0.7) libtool. Initial estimates show that it + may be up to 3 times slower, and 5 times larger than libtool-0.9. + I'll probably have to rewrite it in Guile to get reasonable + performance, which will severely limit its portability for a + while. + + That will also introduce a bootstrapping issue, since the next + release of Guile will use libtool to build shared libraries. So, + if users want to have shared Guile libraries, they will have to + configure Guile with `--disable-shared', compile it, install it, + then reconfigure Guile with `--enable-shared' and repeat. + + I was hoping to get libtool 1.0 out the door by early April, but + now it looks like it will take at least another year before it'll + be usable by the public at large. April fools. + + * ltconfig.in (verify_host): Remove redundant `Transform *-*-linux* + to *-*-linux-gnu*'. From Bruno Haible. + Mon Mar 31 16:15:03 1997 Gordon Matzigkeit + * Makefile.am: Use the new AUTOMAKE and ACLOCAL variables. + * ltmain.sh.in (link): Only fail if a convenience library doesn't exist, and the user specified -whole-archive. + Fix shell quoting that was breaking @OUTPUT@ substitution. Fri Mar 28 19:09:08 1997 Gordon Matzigkeit diff --git a/Makefile.am b/Makefile.am index 8958644a..db49b86f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,11 +34,8 @@ bin_SCRIPTS = libtool libtoolize libtool: ltconfig @echo 'WARNING: Warnings from ltconfig can be ignored. :-)' - CC="${CC}" \ - CFLAGS="${CFLAGS}" \ - CPPFLAGS="${CPPFLAGS}" \ - LD="${LD}" \ - RANLIB="${RANLIB}" \ + CC="${CC}" CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" \ + LD="${LD}" RANLIB="${RANLIB}" \ $(srcdir)/ltconfig --srcdir=$(srcdir) $(pkgdatadir)/ltmain.sh # These depend on config.status for version numbers. @@ -59,7 +56,7 @@ dist-hook: $(demo_distfiles) -chmod 755 $(distdir)/demo here=`pwd`; distdir=`cd $(distdir) && pwd` \ && cd $(srcdir)/demo \ - && automake --include-deps --build-dir=$$here/demo --srcdir-name=$(srcdir)/demo --output-dir=$$distdir/demo + && $(AUTOMAKE) --include-deps --build-dir=$$here/demo --srcdir-name=$(srcdir)/demo --output-dir=$$distdir/demo @for file in $(demo_distfiles); do \ d=$(srcdir); \ test -f $(distdir)/$$file \ @@ -72,13 +69,13 @@ all: demo/Makefile.in demo/configure # Rules for rebuilding some of the demo source files. $(srcdir)/demo/Makefile.in: demo/Makefile.am demo/configure.in demo/aclocal.m4 - cd $(srcdir)/demo && automake + cd $(srcdir)/demo && $(AUTOMAKE) $(srcdir)/demo/configure: demo/configure.in demo/aclocal.m4 - cd $(srcdir)/demo && autoconf + cd $(srcdir)/demo && $(AUTOMAKE) $(srcdir)/demo/aclocal.m4: demo/configure.in demo/acinclude.m4 - cd $(srcdir)/demo && aclocal + cd $(srcdir)/demo && $(ACLOCAL) $(srcdir)/demo/acinclude.m4: rm -f $(srcdir)/demo/acinclude.m4 diff --git a/NEWS b/NEWS index 44ca714f..92fd92fc 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,13 @@ NEWS - list of user-visible changes between releases of GNU libtool. +New in 0.9c: +* Bug fixes. +* New Autoconf macros, AM_REPLACE_FUNCS, AM_FUNC_ALLOCA, AM_FUNC_MEMCMP, + AM_STRUCT_ST_BLOCKS that set and substitute LTLIBOBJS and LTALLOCA. +* Automake support for Libtool now uses the LTLIBRARIES primary. See + the Automake documentation for more information. +* Support *-*-linux-gnu* as an alias for *-*-linux*. + New in 0.9: * Bug fixes. * The libtool demo now uses the libm cos(3) function, to demonstrate diff --git a/PLATFORMS b/PLATFORMS index 3d28217d..2ea77c54 100644 --- a/PLATFORMS +++ b/PLATFORMS @@ -7,18 +7,24 @@ alpha-dec-osf3.2 cc 0.7a fail hppa1.1-hp-hpux9.05 gcc 0.7a fail hppa1.1-hp-hpux9.05 cc 0.7a fail hppa1.1-hp-hpux10.10 cc 0.7a fail +i386-unknown-linux gcc 0.7c ok +i386-unknown-netbsd1.2 gcc 0.7c ok mips-sgi-irix5.3 gcc 0.7a fail mips-sgi-irix5.3 cc 0.7a fail mips-sgi-irix6.2 cc -32 0.7a fail mips-sgi-irix6.2 cc -n32 0.7a fail -rs6000-ibm-aix3.2.5 gcc* 0.7a gcc bug, fail demo-unst -rs6000-ibm-aix3.2.5 xlc 0.7a fail demo-unst -rs6000-ibm-aix4.1.4.0 gcc 0.7a fail demo-inst -rs6000-ibm-aix4.1.4.0 xlc 0.7a fail demo-inst +rs6000-ibm-aix3.2.5 gcc 0.7c ok* +rs6000-ibm-aix3.2.5 xlc 0.7c ok +rs6000-ibm-aix4.1.4.0 gcc 0.7c ok** +rs6000-ibm-aix4.1.4.0 xlc 0.7c ok** sparc-sun-sunos4.1.3_U1 gcc 0.7a ok sparc-sun-sunos4.1.3_U1 cc 0.7a ok sparc-sun-solaris2.4 gcc 0.7a ok sparc-sun-solaris2.4 cc 0.7a ok +sparc-sun-solaris2.5.1 gcc 0.7c ok ---------------------------------------------------------------------- -* GCC version 2.6.1. +* GCC 2.6.1 prints warnings about multiple symbol definitions. + +** Autoconf 2.12 uses /usr/bin/installbsd, which is buggy, so that + demo-inst fails. diff --git a/README b/README index ca7e7157..e3e27cb2 100644 --- a/README +++ b/README @@ -28,9 +28,8 @@ See the file INSTALL for instructions on how to build and install libtool. See the file README-automake for details on Automake support for libtool. -See the file PLATFORMS for a list of platforms that libtool shared -library support was tested on. This information is also in -(libtool)Tested Platforms. +See the info node (libtool)Tested Platforms. (or the file doc/platforms.texi) +for a list of platforms that libtool shared library support was tested on. If you have any suggestions or bug reports, or you wish to port libtool to a new platform, please send electronic mail to Gord Matzigkeit diff --git a/README-alpha b/README-alpha index 2ff6082e..22e7f898 100644 --- a/README-alpha +++ b/README-alpha @@ -10,7 +10,7 @@ working closely with Tom Tromey to integrate libtool patches into Automake. In the meantime, just ignore these references, or use Gord's -modified version of automake-1.1g that supports all the features +modified version of automake-1.1i that supports all the features described in the libtool manual: - + diff --git a/README-automake b/README-automake index 31b3f849..554b6b22 100644 --- a/README-automake +++ b/README-automake @@ -10,7 +10,11 @@ bugs) at: Once Automake 1.2 is released, you should get it from your closest GNU mirror. -** If you get automake-1.1k, you'll need to apply the following patch +Thanks, + +--Gord + +** If you have automake-1.1k, you'll need to apply the following patch before installing it: diff -u automake-1.1k/automake.in.orig automake-1.1k/automake.in diff --git a/THANKS b/THANKS index e87c393b..58cac54d 100644 --- a/THANKS +++ b/THANKS @@ -6,6 +6,7 @@ Bruno Haible Charles S. Kerr Joel Cannon Karl Berry +Mark Kettenis Mimi Burbank Oliver Guntermann Thomas Esser diff --git a/TODO b/TODO index a25908c2..9d6d74d7 100644 --- a/TODO +++ b/TODO @@ -1,17 +1,21 @@ -* Implement new idea for Automake support: LTLIBRARIES. +* Need to change `-rpath FOO -rpath BAR' to `-rpath FOO:BAR' with at +least OSF/1 ld. For 1.1: +* Complete the -export-dynamic flag, and the new dlname mode. + +* Complete convenience libraries made of libtool objects. Document +-whole-archive and -no-whole-archive. We also need a way to use these +convenience libraries just to resolve symbols, rather than the +(simplistic) whole-archive and no-whole-archive. + * Write libtool not to be dependent on the compiler used to configure it. * Implement full multi-language support. There are beginnings of this in the manual (Other Languages). -* Consider allowing the creation of convenience libraries made of -libtool objects. From David Mosberger-Tang. Think about how this -would be done with Automake. - Sometime in the future (maybe): * Implement `-static' linking against installed libraries, even when diff --git a/configure.in b/configure.in index 18a05b06..8c70b8ef 100644 --- a/configure.in +++ b/configure.in @@ -1,9 +1,21 @@ +dnl Process this file with autoconf to create configure. AC_INIT(ltmain.sh.in) -AM_INIT_AUTOMAKE(libtool, 0.9c) +AM_INIT_AUTOMAKE(libtool,0.9d) pkgdatadir='${datadir}/libtool' AC_SUBST(pkgdatadir) aclocaldir='${datadir}/aclocal' AC_SUBST(aclocaldir) +dnl Use the specified CC, RANLIB, and LD while running ltconfig. +AC_PROG_CC +AC_PROG_RANLIB +LD="${LD-ld}" +AC_SUBST(LD) + AC_OUTPUT([Makefile doc/Makefile tests/Makefile]) + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/demo/Makefile.am b/demo/Makefile.am index 63d93bcf..f9e491b8 100644 --- a/demo/Makefile.am +++ b/demo/Makefile.am @@ -7,9 +7,9 @@ hardcode_tests = hc-direct hc-minusL hc-libpath CLEANFILES = $(hardcode_tests) # Build a libtool library, libhello.la for installation in libdir. -lib_PROGRAMS = libhello.la +lib_LTLIBRARIES = libhello.la libhello_la_SOURCES = hello.c foo.c -libhello_la_LDFLAGS = -version-info 3:12:1 -rpath $(libdir) +libhello_la_LDFLAGS = -version-info 3:12:1 include_HEADERS = foo.h diff --git a/demo/configure.in b/demo/configure.in index 92f028e1..f7b80378 100644 --- a/demo/configure.in +++ b/demo/configure.in @@ -3,7 +3,6 @@ AC_INIT(hello.c) AM_INIT_AUTOMAKE(hell,1.0) AC_PROG_CC -AM_C_PROTOTYPES AM_PROG_LIBTOOL dnl Output the makefile diff --git a/demo/foo.c b/demo/foo.c index 68b6d4d8..c1003b75 100644 --- a/demo/foo.c +++ b/demo/foo.c @@ -18,9 +18,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Written by Gordon Matzigkeit */ #include "foo.h" +#include +#include int foo () { + printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0)); return FOO_RET; } diff --git a/demo/foo.h b/demo/foo.h index 860781bd..59ac8eeb 100644 --- a/demo/foo.h +++ b/demo/foo.h @@ -19,42 +19,36 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Only include this header file once. */ #ifndef _FOO_H_ -#define _FOO_H_ +#define _FOO_H_ 1 /* __BEGIN_DECLS should be used at the beginning of your C declarations, - so that C++ compilers don't mangle their names. */ -#ifndef __BEGIN_DECLS -# ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# else -# define __BEGIN_DECLS -# endif -#endif -#ifndef __END_DECLS -# ifdef __cplusplus -# define __END_DECLS }; -# else -# define __END_DECLS -# endif + so that C++ compilers don't mangle their names. __END_DECLS is used + at the end of C declarations. */ +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ #endif /* __P is a macro used to wrap function prototypes, so that compilers that don't understand ANSI C prototypes still work, and ANSI C compilers can issue warnings about type mismatches. */ -#ifndef __P -# if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus) -# define __P(protos) protos -# else -# define __P(protos) () -# endif +#undef __P +#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus) +# define __P(protos) protos +#else +# define __P(protos) () #endif /* Silly constants that the functions return. */ #define HELLO_RET 0xe110 #define FOO_RET 0xf00 -/* Function declarations. Note the wonderful use of the macros we defined - above (__BEGIN_DECLS, __END_DECLS, and __P). */ +/* Function declarations. Note the wonderful use of the above macros. */ __BEGIN_DECLS int foo __P((void)); int hello __P((void)); diff --git a/demo/hello.c b/demo/hello.c index a77bf8b9..4b1943f1 100644 --- a/demo/hello.c +++ b/demo/hello.c @@ -21,7 +21,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include int -hello () +hello (void) { printf ("** This is not GNU Hello. There is no built-in mail reader. **\n"); return HELLO_RET; diff --git a/demo/main.c b/demo/main.c index fd23f143..d62cc80a 100644 --- a/demo/main.c +++ b/demo/main.c @@ -21,7 +21,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include int -main (int argc, char **argv) +main (argc, argv) + int argc; + char **argv; { printf ("Welcome to GNU Hell!\n"); diff --git a/doc/Makefile.am b/doc/Makefile.am index fcaa1b42..cc6f4816 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -7,5 +7,4 @@ ## Written by Gordon Matzigkeit AUTOMAKE_OPTIONS = gnits info_TEXINFOS = libtool.texi - -libtool.info: ../PLATFORMS +libtool_TEXINFOS = platforms.texi diff --git a/doc/libtool.texi b/doc/libtool.texi index 8b56b5b3..d130ccf4 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -4,22 +4,22 @@ @settitle libtool @setchapternewpage off @c %**end of header -@syncodeindex vr cp -@synindex pg cp @include version.texi @set BUGADDR Gord Matzigkeit -@ifinfo -@format -START-INFO-DIR-ENTRY -* Libtool: (libtool). Generic shared library support script. -END-INFO-DIR-ENTRY -@end format -@end ifinfo +@dircategory GNU programming tools +@direntry +* Libtool: (libtool). Generic shared library support script. +@end direntry + +@dircategory Individual utilities +@direntry +* libtoolize: (libtool)Invoking libtoolize. Adding libtool support. +@end direntry @ifinfo -This file documents the Libtool library support script. +This file documents GNU libtool @value{VERSION} Copyright (C) 1996, 1997 Free Software Foundation, Inc. @@ -49,12 +49,13 @@ approved by the Foundation. @titlepage @title GNU Libtool @subtitle For version @value{VERSION}, @value{UPDATED} -@c copyright page +@author Gordon Matzigkeit + @page @vskip 0pt plus 1filll Copyright @copyright{} 1996, 1997 Free Software Foundation, Inc. @sp 2 -This is the second edition of the GNU Libtool documentation,@* +This is the first edition of the GNU Libtool documentation,@* and is consistent with GNU Libtool @value{VERSION}.@* @sp 2 Published by the Free Software Foundation @* @@ -76,6 +77,10 @@ except that this permission notice may be stated in a translation approved by the Free Software Foundation. @end titlepage +@c Put everything in one index (arbitrarily chosen to be the concept index). +@syncodeindex vr cp +@synindex pg cp + @ifinfo @node Top, Introduction, (dir), (dir) @comment node-name, next, previous, up @@ -94,10 +99,11 @@ version @value{VERSION}. * Versioning:: Using library interface versions. * Library Tips:: Tips for library interface design. * Other Languages:: Using libtool without a C compiler. -* Maintaining:: Information used by the libtool maintainer. * Troubleshooting:: When libtool doesn't work as advertised. +* Maintaining:: Information used by the libtool maintainer. * Index:: Index of concepts, variables, and programs. +@detailmenu --- The Detailed Node Listing --- Introduction @@ -155,6 +161,16 @@ Using Libtool with Other Languages * C++ Libraries:: Using libtool with C++. +Troubleshooting + +* Libtool Test Suite:: Libtool's self-tests. +* Reporting Bugs:: How to report problems with libtool. + +The Libtool Test Suite + +* Test Descriptions:: The contents of the test suite. +* When Tests Fail:: What to do when a test fails. + Maintainance Notes for Libtool * New Ports:: How to port libtool to new systems. @@ -168,22 +184,12 @@ Platform Quirks * Reloadable Objects:: Binding object files together. * Archivers:: Programs that create static archives. * Strip:: Removing unnecessary linkage information. - -Troubleshooting - -* Libtool Test Suite:: Libtool's self-tests. -* Reporting Bugs:: How to report problems with libtool. - -The Libtool Test Suite - -* Test Descriptions:: The contents of the test suite. -* When Tests Fail:: What to do when a test fails. +@end detailmenu @end menu @end ifinfo -@node Introduction, Libtool Paradigm, Top, Top -@comment node-name, next, previous, up +@node Introduction @chapter Introduction In the past, if a source code package developer wanted to take advantage @@ -223,8 +229,7 @@ or want to write code to extend libtool in a consistent way. * Postmortem:: Learning from past difficulties. @end menu -@node Motivation, Issues, Introduction, Introduction -@comment node-name, next, previous, up +@node Motivation @section Motivation for Writing Libtool @cindex Motivation for writing libtool @@ -262,8 +267,7 @@ non-GNU packages. Portability to other (non-GNU) architectures and tools is desirable. @end enumerate -@node Issues, Other Implementations, Motivation, Introduction -@comment node-name, next, previous, up +@node Issues @section Implementation Issues @cindex Tricky design issues @@ -306,8 +310,7 @@ The install Makefile target should warn the user to set required. @end enumerate -@node Other Implementations, Postmortem, Issues, Introduction -@comment node-name, next, previous, up +@node Other Implementations @section Other Implementations I have investigated several different implementations of building shared @@ -318,8 +321,7 @@ Now it is clear that none of these packages have documented the details of shared library systems that libtool requires. So, other packages have been more or less abandoned as influences. -@node Postmortem, , Other Implementations, Introduction -@comment node-name, next, previous, up +@node Postmortem @section A Postmortem Analysis of Other Implementations @cindex Other implementations, flaws in @@ -354,8 +356,7 @@ I hope that libtool will be useful to and used by the GNU community, and that the lessons I've learned in writing it will be taken up and implemented by designers of library systems. -@node Libtool Paradigm, Using Libtool, Introduction, Top -@comment node-name, next, previous, up +@node Libtool Paradigm @chapter The Libtool Paradigm At first, libtool was designed to support an arbitrary number of library @@ -377,8 +378,7 @@ the paradigm of existing library systems, with examples from each. It is a new way of thinking, so it may take a little time to absorb, but when you understand it the world gets simpler. -@node Using Libtool, Invoking libtool, Libtool Paradigm, Top -@comment node-name, next, previous, up +@node Using Libtool @chapter Using Libtool @cindex Examples of using libtool @@ -406,6 +406,17 @@ subdirectory of the libtool distribution. Assume that we are building a library, @file{libhello}, out of the files @file{foo.c} and @file{hello.c}. +Note that the @file{foo.c} source file uses the cos(3) math library +function, which is usually found in the standalone math library, and not +the C library. So, whenever we link an executable or a library against +@file{foo.o} or @file{foo.lo}, we need to add @kbd{-lm} to the end of +the link line. + +The same rule applies whenever you use functions that don't appear in +the standard C library@dots{} you need to add the appropriate +@kbd{-l@var{name}} flag to the end of the link line when you link +against those objects. + After we have built that library, we want to create a program by linking @file{main.o} against @file{libhello}. @@ -418,8 +429,7 @@ After we have built that library, we want to create a program by linking * Static Libraries:: When shared libraries are not wanted. @end menu -@node Creating Object Files, Linking Libraries, Using Libtool, Using Libtool -@comment node-name, next, previous, up +@node Creating Object Files @section Creating Object Files @cindex Compiling object files @@ -496,8 +506,7 @@ gcc -g -O -c hello.c burger$ @end example -@node Linking Libraries, Linking Executables, Creating Object Files, Using Libtool -@comment node-name, next, previous, up +@node Linking Libraries @section Linking Libraries @pindex ar @@ -543,10 +552,13 @@ 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: +So, let's try again, this time with the library object +files:@footnote{Remember that we need to add @kbd{-lm} to the link +command line because @file{foo.c} uses the cos(3) math library +function. @xref{Using Libtool}.} @example -a23$ @kbd{libtool gcc -g -O -o libhello.la foo.lo hello.lo} +a23$ @kbd{libtool gcc -g -O -o libhello.la foo.lo hello.lo -lm} libtool: you must specify an installation directory with `-rpath' a23$ @end example @@ -558,7 +570,7 @@ installed. So, we try again, with an @code{rpath} setting of @example a23$ @kbd{libtool gcc -g -O -o libhello.la foo.lo hello.lo \ - -rpath /usr/local/lib} + -rpath /usr/local/lib -lm} mkdir .libs ar cru .libs/libhello.a foo.o hello.o ranlib .libs/libhello.a @@ -570,10 +582,9 @@ 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} + -rpath /usr/local/lib -lm} mkdir .libs -rm -f .libs/libhello.* -ld -Bshareable -o .libs/libhello.so.0.0 foo.lo hello.lo +ld -Bshareable -o .libs/libhello.so.0.0 foo.lo hello.lo -lm ar cru .libs/libhello.a foo.o hello.o ranlib .libs/libhello.a creating libhello.la @@ -590,8 +601,7 @@ 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. -@node Linking Executables, Installing Libraries, Linking Libraries, Using Libtool -@comment node-name, next, previous, up +@node Linking Executables @section Linking Executables @cindex Linking against installed libraries @@ -621,7 +631,7 @@ it, you must use libtool to do the linking. Here's the old way of linking against an uninstalled library: @example -burger$ @kbd{gcc -g -O -o hell.old main.o libhello.a} +burger$ @kbd{gcc -g -O -o hell.old main.o libhello.a -lm} burger$ @end example @@ -632,8 +642,8 @@ library. Just specify the relative path to the `.la' file, such as any ambiguity when linking against uninstalled shared libraries.}: @example -a23$ @kbd{libtool gcc -g -O -o hell main.o libhello.la} -gcc -g -O -o hell main.o ./.libs/libhello.a +a23$ @kbd{libtool gcc -g -O -o hell main.o libhello.la -lm} +gcc -g -O -o hell main.o ./.libs/libhello.a -lm a23$ @end example @@ -644,8 +654,8 @@ That looks too simple to be true. All libtool did was transform 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 +burger$ @kbd{libtool gcc -g -O -o hell main.o libhello.la -lm} +gcc -g -O -o .libs/hell main.o -L./.libs -R/usr/local/lib -lhello -lm creating hell burger$ @end example @@ -703,8 +713,7 @@ price of being dynamic is eight kilobytes, and the payoff is about four kilobytes. So, having a shared @file{libhello} won't be an advantage until we link it against at least a few more programs. -@node Installing Libraries, Installing Executables, Linking Executables, Using Libtool -@comment node-name, next, previous, up +@node Installing Libraries @section Installing Libraries @pindex strip @@ -785,8 +794,7 @@ After you have completed these steps, you can go on to begin using the installed libraries. You may also install any executables that depend on libraries you created. -@node Installing Executables, Static Libraries, Installing Libraries, Using Libtool -@comment node-name, next, previous, up +@node Installing Executables @section Installing Executables If you used libtool to link any executables against uninstalled libtool @@ -811,8 +819,7 @@ install -c .libs/hell /usr/local/bin/hell burger# @end example -@node Static Libraries, , Installing Executables, Using Libtool -@comment node-name, next, previous, up +@node Static Libraries @section Linking Static Libraries @cindex Static linking @@ -838,7 +845,7 @@ Link the files in the same way you would a libtool library, but use a `.a' suffix (instead of `.la'): @example -burger$ @kbd{libtool gcc -o libhello.a main.o foo.lo hello.lo} +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 @@ -862,8 +869,7 @@ 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. -@node Invoking libtool, Integrating Libtool, Using Libtool, Top -@comment node-name, next, previous, up +@node Invoking libtool @chapter Invoking @file{libtool} @c FIXME this is where I got sick of writing index entries @@ -925,8 +931,7 @@ Print libtool version information and exit. * Uninstall Mode:: Removing executables and libraries. @end menu -@node Compile Mode, Link Mode, Invoking libtool, Invoking libtool -@comment node-name, next, previous, up +@node Compile Mode @section Compile Mode For @samp{compile} mode, @var{mode-args} is a compiler command to be @@ -941,8 +946,7 @@ suffix `.c' with the library object suffix, `.lo'. If shared libraries are being built, any necessary PIC generation flags are substituted into the compilation command. -@node Link Mode, Install Mode, Compile Mode, Invoking libtool -@comment node-name, next, previous, up +@node Link Mode @section Link Mode @samp{link} mode links together object files (including library @@ -960,6 +964,8 @@ installed. @item -l@var{name} @var{output-file} requires the installed library @file{lib@var{name}}. +This option is required even when @var{output-file} is not an +executable. @item -o @var{output-file} Create @var{output-file} from the specified objects and libraries. @@ -994,8 +1000,7 @@ This method is called @dfn{incremental linking}. Otherwise, an executable program is created. -@node Install Mode, Finish Mode, Link Mode, Invoking libtool -@comment node-name, next, previous, up +@node Install Mode @section Install Mode In @samp{install} mode, libtool interprets @var{mode-args} as an @@ -1008,8 +1013,7 @@ command. The command is run, and any necessary unprivileged post-installation commands are also completed. -@node Finish Mode, Uninstall Mode, Install Mode, Invoking libtool -@comment node-name, next, previous, up +@node Finish Mode @section Finish Mode @samp{finish} mode helps system administrators install libtool @@ -1019,8 +1023,7 @@ Each @var{mode-arg} is interpreted as the name of a library directory. Running this command may require superuser privileges, so the @samp{--dry-run} option may be useful. -@node Uninstall Mode, , Finish Mode, Invoking libtool -@comment node-name, next, previous, up +@node Uninstall Mode @section Uninstall Mode This mode deletes installed libraries (and other files). @@ -1031,8 +1034,7 @@ files (typically @file{/bin/rm}). The remaning @var{mode-args} are either flags for the deletion program (beginning with a `-'), or the names of files to delete. -@node Integrating Libtool, Versioning, Invoking libtool, Top -@comment node-name, next, previous, up +@node Integrating Libtool @chapter Integrating Libtool with Your Own Packages This chapter describes how to integrate libtool with your packages so @@ -1045,8 +1047,7 @@ that your users can install hassle-free shared libraries. * Distributing:: What files to distribute with your package. @end menu -@node Makefile Rules, Using Automake, Integrating Libtool, Integrating Libtool -@comment node-name, next, previous, up +@node Makefile Rules @section Writing Makefile Rules for Libtool Libtool is fully integrated with Automake (@pxref{Top, , The Automake @@ -1072,8 +1073,7 @@ subdirectory of the libtool distribution@dots{} note especially that it was generated automatically from the @file{Makefile.am} by Automake). @end enumerate -@node Using Automake, Configuring, Makefile Rules, Integrating Libtool -@comment node-name, next, previous, up +@node Using Automake @section Using Automake with Libtool Libtool library support fits conveniently into Automake's understanding @@ -1113,8 +1113,7 @@ libhello_la_SOURCES = hello.c foo.c libhello_la_LDFLAGS = -version-info 3:12:1 -rpath $(libdir) @end example -@node Configuring, Distributing, Using Automake, Integrating Libtool -@comment node-name, next, previous, up +@node Configuring @section Configuring Libtool Libtool requires intimate knowledge of your compiler suite and operating @@ -1142,8 +1141,7 @@ Libtool has its own equivalent to the @file{configure} script, * AM_PROG_LIBTOOL:: Configuring @file{libtool} in @file{configure.in}. @end menu -@node Invoking ltconfig, ltconfig Example, Configuring, Configuring -@comment node-name, next, previous, up +@node Invoking ltconfig @subsection Invoking @file{ltconfig} @file{ltconfig} runs a series of configuration tests, then creates a @@ -1208,8 +1206,7 @@ The system linker to use (if the generated @file{libtool} requires one). Program to use rather than checking for @file{ranlib}. @end table -@node ltconfig Example, AM_PROG_LIBTOOL, Invoking ltconfig, Configuring -@comment node-name, next, previous, up +@node ltconfig Example @subsection Using @file{ltconfig} Here is a simple example of using @file{ltconfig} to configure libtool @@ -1254,8 +1251,7 @@ creating libtool burger$ @end example -@node AM_PROG_LIBTOOL, , ltconfig Example, Configuring -@comment node-name, next, previous, up +@node AM_PROG_LIBTOOL @subsection The @code{AM_PROG_LIBTOOL} macro If you are using GNU Autoconf (or Automake), you should add a call to @@ -1276,8 +1272,7 @@ you define the Makefile variable @code{top_builddir} in your 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 +@node Distributing @section Including Libtool with Your Package In order to use libtool, you need to include the following files with @@ -1307,8 +1302,7 @@ use the @file{libtoolize} program. * Invoking libtoolize:: @file{libtoolize} command line options. @end menu -@node Invoking libtoolize, , Distributing, Distributing -@comment node-name, next, previous, up +@node Invoking libtoolize @subsection Invoking @file{libtoolize} The @file{libtoolize} program provides a standard way to add libtool @@ -1362,8 +1356,7 @@ will put the files in the specified directory. @file{libtoolize} displays hints for adding libtool support to your package, as well. -@node Versioning, Library Tips, Integrating Libtool, Top -@comment node-name, next, previous, up +@node Versioning @chapter Library Interface Versions The most difficult issue introduced by shared libraries is that of @@ -1392,8 +1385,7 @@ require. * Updating Version Info:: Changing version information before releases. @end menu -@node Interfaces, Libtool Versioning, Versioning, Versioning -@comment node-name, next, previous, up +@node Interfaces @section What Are Library Interfaces? Interfaces for libraries may be any of the following (and more): @@ -1415,8 +1407,7 @@ sockets, pipes, and other inter-process communication protocols Note that static functions do not count as interfaces, because they are not directly available to the user of the library. -@node Libtool Versioning, Updating Version Info, Interfaces, Versioning -@comment node-name, next, previous, up +@node Libtool Versioning @section Libtool's Versioning System Libtool has its own formal versioning system. It is not as flexible as @@ -1472,8 +1463,7 @@ If two libraries have identical @var{current} and @var{age} numbers, then the dynamic linker chooses the library with the greater @var{revision} number. -@node Updating Version Info, , Libtool Versioning, Versioning -@comment node-name, next, previous, up +@node Updating Version Info @section Updating the Library Version Information If you want to use libtool's versioning system, then you must specify @@ -1523,8 +1513,7 @@ set @var{age} to 0. to the release of the package that you are making. This is an abuse that only fosters misunderstanding of the purpose of library versions. -@node Library Tips, Other Languages, Versioning, Top -@comment node-name, next, previous, up +@node Library Tips @chapter Tips for Interface Design Writing a good library interface takes a lot of practice and thorough @@ -1577,8 +1566,7 @@ aren't interface changes. * C Header Files:: How to write portable include files. @end menu -@node C Header Files, , Library Tips, Library Tips -@comment node-name, next, previous, up +@node C Header Files @section Writing C Header Files Writing portable C header files can be difficult, since they may be read @@ -1681,8 +1669,7 @@ compilers, especially pre-ANSI compilers. The @code{long double} type is not supported by many compilers. @end itemize -@node Other Languages, Maintaining, Library Tips, Top -@comment node-name, next, previous, up +@node Other Languages @chapter Using Libtool with Other Languages Libtool was first implemented in order to add support for writing shared @@ -1697,8 +1684,7 @@ and what special considerations you need to make if you do not use C. * C++ Libraries:: Using libtool with C++. @end menu -@node C++ Libraries, , Other Languages, Other Languages -@comment node-name, next, previous, up +@node C++ Libraries @section Writing Libraries for C++ Creating libraries of C++ code is a fairly straightforward process, and @@ -1725,8 +1711,7 @@ compiler. There are ways of working around this problem, but they are beyond the scope of this manual. -@node Troubleshooting, Index, Maintaining, Top -@comment node-name, next, previous, up +@node Troubleshooting @chapter Troubleshooting Libtool is under constant development, changing to keep up-to-date with @@ -1739,8 +1724,7 @@ what the problem is, and how to resolve it. * Reporting Bugs:: How to report problems with libtool. @end menu -@node Libtool Test Suite, Reporting Bugs, Troubleshooting, Troubleshooting -@comment node-name, next, previous, up +@node Libtool Test Suite @section The Libtool Test Suite Libtool comes with its own set of programs that test its capabilities, @@ -1758,8 +1742,7 @@ programs. * When Tests Fail:: What to do when a test fails. @end menu -@node Test Descriptions, When Tests Fail, Libtool Test Suite, Libtool Test Suite -@comment node-name, next, previous, up +@node Test Descriptions @subsection Description of Test Suite Here is a list of the current programs in the test suite, and what they @@ -1805,8 +1788,7 @@ the libtool scripts. Checking for the existence of a file can only be done in a portable way by using @code{test -f}. @end table -@node When Tests Fail, , Test Descriptions, Libtool Test Suite -@comment node-name, next, previous, up +@node When Tests Fail @subsection When Tests Fail Each of the above tests are designed to produce no output when they are @@ -1825,8 +1807,7 @@ Another way to have the test programs produce output is to set the For example, @kbd{env VERBOSE=yes make check} runs all the tests, and has each of them display debugging information. -@node Reporting Bugs, , Libtool Test Suite, Troubleshooting -@comment node-name, next, previous, up +@node Reporting Bugs @section Reporting Bugs If you think you have discovered a bug in libtool, you should think @@ -1859,8 +1840,7 @@ the details needed to reproduce the bug, and a brief description of why you think the behaviour is a bug. Be sure to include the word ``libtool'' in the subject line. -@node Maintaining, Troubleshooting, Other Languages, Top -@comment node-name, next, previous, up +@node Maintaining @chapter Maintainance Notes for Libtool This chapter contains information that the libtool maintainer finds @@ -1874,8 +1854,7 @@ porting libtool to new systems, or writing your own libtool. * libtool Script Contents:: Configuration information that libtool uses. @end menu -@node New Ports, Tested Platforms, Maintaining, Maintaining -@comment node-name, next, previous, up +@node New Ports @section Porting libtool to New Systems To port libtool to a new system, you'll generally need the following @@ -1904,24 +1883,21 @@ Some systems have special documentation on how to build and install shared libraries. @end table -@node Tested Platforms, Platform Quirks, New Ports, Maintaining -@comment node-name, next, previous, up +@node Tested Platforms @section Tested Platforms -This table (the @file{PLATFORMS} file in the libtool distribution) -describes when libtool was last known to be tested on platforms where it -claims to support shared libraries: +This table describes when libtool was last known to be tested on +platforms where it claims to support shared libraries: @example -@include ../PLATFORMS +@include platforms.texi @end example Libtool versions ending in a single letter (such as @samp{0.7a}) designate beta releases. So, @samp{0.7a} comes after public release @samp{0.7}, but before @samp{0.8}. -@node Platform Quirks, libtool Script Contents, Tested Platforms, Maintaining -@comment node-name, next, previous, up +@node Platform Quirks @section Platform Quirks This section is dedicated to the sanity of the libtool maintainer. It @@ -1941,8 +1917,7 @@ improve libtool, or write your own. * Strip:: Removing unnecessary linkage information. @end menu -@node Compilers, Reloadable Objects, Platform Quirks, Platform Quirks -@comment node-name, next, previous, up +@node Compilers @subsection Compilers The only compiler characteristics that affect libtool are the flags @@ -2000,8 +1975,7 @@ Use @samp{-KPIC} to generate PIC. Use @samp{-PIC} to generate PIC. @end table -@node Reloadable Objects, Archivers, Compilers, Platform Quirks -@comment node-name, next, previous, up +@node Reloadable Objects @subsection Reloadable Objects On all known systems, a reloadable object can be created by running @@ -2009,8 +1983,7 @@ On all known systems, a reloadable object can be created by running reloadable object may be treated as exactly equivalent to other objects. -@node Archivers, Strip, Reloadable Objects, Platform Quirks -@comment node-name, next, previous, up +@node Archivers @subsection Archivers On all known systems, building a static library can be accomplished by @@ -2022,8 +1995,7 @@ On all known systems, if there is a program named @file{ranlib}, then it must be used to ``bless'' the created library before linking against it, with the @kbd{ranlib lib@var{name}.a} command. -@node Strip, , Archivers, Platform Quirks -@comment node-name, next, previous, up +@node Strip @subsection The @file{strip} Program Stripping a library is essentially the same problem as stripping an @@ -2049,8 +2021,7 @@ HP-UX @file{strip} requires that @samp{-r} and @samp{-x} flags in order to strip libraries. @end table -@node libtool Script Contents, , Platform Quirks, Maintaining -@comment node-name, next, previous, up +@node libtool Script Contents @section @file{libtool} Script Contents The @file{libtool} script is generated by @file{ltconfig} @@ -2157,8 +2128,7 @@ of commands that are evaluated one after another. If any of the commands return a nonzero exit status, libtool generally exits with an error message. -@node Index, , Troubleshooting, Top -@comment node-name, next, previous, up +@node Index @unnumbered Index @printindex cp diff --git a/doc/platforms.texi b/doc/platforms.texi index 56d1765c..8353df2f 100644 --- a/doc/platforms.texi +++ b/doc/platforms.texi @@ -4,28 +4,31 @@ canonical host name compiler libtool results -------------------------------------------------------- alpha-dec-osf3.2 cc 0.8 ok alpha-dec-osf3.2 gcc 0.8 ok -hppa1.1-hp-hpux9.05 cc 0.8 ok* -hppa1.1-hp-hpux9.05 gcc 0.8 ok* +alpha-dec-osf4.0 cc 0.9 ok +alpha-dec-osf4.0 gcc 0.9 ok +hppa1.1-hp-hpux9.05 cc 0.8 ok +hppa1.1-hp-hpux9.05 gcc 0.8 ok 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-linux2.0.16 gcc 0.9 ok -i386-unknown-netbsd1.2 gcc 0.9 ok +i386-unknown-netbsd1.2 gcc 0.9a ok +i586-unknown-linux1.3.20 gcc 0.9 ok +i586-unknown-linux2.0.16 gcc 0.9a ok mips-sgi-irix5.3 cc 0.8 ok mips-sgi-irix5.3 gcc 0.8 ok -mips-sgi-irix6.2 cc -32 0.8 ok -mips-sgi-irix6.2 cc -n32 0.8 fail -rs6000-ibm-aix3.2.5 xlc 0.8 ok -rs6000-ibm-aix3.2.5 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.9a ok +powerpc-ibm-aix4.1.4.0 gcc 0.9a ok +rs6000-ibm-aix3.2.5 xlc 0.9 fail +rs6000-ibm-aix3.2.5 gcc 0.9 fail rs6000-ibm-aix4.1.4.0 xlc 0.9 ok -rs6000-ibm-aix4.1.4.0 gcc 0.7c ok -sparc-sun-linux2.1.14 gcc 0.7c ok -sparc-sun-sunos4.1.3_U1 cc 0.7a ok -sparc-sun-sunos4.1.3_U1 gcc 0.7a ok -sparc-sun-solaris2.4 cc 0.7a ok -sparc-sun-solaris2.4 gcc 0.7a ok -sparc-sun-solaris2.5.1 gcc 0.9 ok +rs6000-ibm-aix4.1.4.0 gcc 0.9 fail +sparc-sun-linux2.1.23 gcc 0.9 ok +sparc-sun-sunos4.1.3_U1 cc 0.9 ok +sparc-sun-sunos4.1.3_U1 gcc 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.9a ok -------------------------------------------------------- - -* `sh internal 2K buffer overflow', under investigation. In the -meantime, set the CONFIG_SHELL environment variable to /usr/bin/ksh. diff --git a/libtool.m4 b/libtool.m4 index 577c4c45..1406286a 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -1,7 +1,27 @@ +## libtool.m4 - Configure libtool for the target system. +## Copyright (C) 1996, 1997 Free Software Foundation, Inc. +## Gordon Matzigkeit , 1996 ## -## Configure libtool for the target system. +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. ## -# serial 1 AM_PROG_LIBTOOL +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 2 AM_PROG_LIBTOOL AC_DEFUN(AM_PROG_LIBTOOL, [AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_CC]) @@ -21,6 +41,11 @@ libtool_flags="$libtool_shared" test "$silent" = yes && libtool_flags="$libtool_flags --silent" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +# On SCO OpenServer 5, we need -belf to get full-featured binaries. +case "$host" in +*-*-sco3.2v5*) CFLAGS="$CFLAGS -belf" ;; +esac + # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LD="$LD" RANLIB="$RANLIB" \ $ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ diff --git a/libtoolize.in b/libtoolize.in index 02921a49..20f05444 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -1,7 +1,7 @@ #! /bin/sh # libtoolize - Prepare a package to use libtool. # @configure_input@ -# Copyright (C) 1996 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify diff --git a/ltconfig.in b/ltconfig.in index e66778df..af5978c9 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -54,12 +54,15 @@ nonopt=NONE verify_host=yes with_gcc=no +old_AR="$AR" old_CC="$CC" old_CFLAGS="$CFLAGS" old_CPPFLAGS="$CPPFLAGS" old_LD="$LD" old_RANLIB="$RANLIB" +test -z "$AR" && AR=ar + # Parse the command line options. args= prev= @@ -265,7 +268,7 @@ host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` # 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' # If RANLIB is not set, then run the test. @@ -496,7 +499,9 @@ echo $ac_t "$with_gnu_ld" 1>&6 echo $ac_n "checking if $linker supports shared libraries... $ac_c" 1>&6 archive_cmds= +export_dynamic_flag= hardcode_libdir_flag_spec= +hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported @@ -524,19 +529,20 @@ if test "$with_gnu_ld" = yes; then if test "$ld_shlibs" = yes; then archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir' + export_dynamic_flag='${wl}-export-dynamic' fi else # PORTME fill in a description of your system's linker (not GNU ld) case "$host" in *-*-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' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes ;; *-*-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' hardcode_minus_L=yes ;; @@ -577,6 +583,7 @@ else *-*-osf3* | *-*-osf4*) archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: ;; *-*-sco3.2v5*) @@ -669,11 +676,7 @@ case "$host" in shlibpath_var=LD_LIBRARY_PATH ;; -*-*-gnu*) - version_type=sunos - library_names_spec='$libname.so.$versuffix' - shlibpath_var=LD_LIBRARY_PATH - ;; +# *-*-gnu* needs to come after *-*-linux-gnu*. *-*-hpux9* | *-*-hpux10*) # Give a soname corresponding to the major version so that dld.sl refuses to @@ -709,6 +712,12 @@ case "$host" in shlibpath_var=LD_LIBRARY_PATH ;; +*-*-gnu*) + version_type=sunos + library_names_spec='$libname.so.$versuffix' + shlibpath_var=LD_LIBRARY_PATH + ;; + *-*-netbsd*) version_type=sunos library_names_spec='$libname.so.$versuffix' @@ -829,6 +838,9 @@ build_old_libs=$enable_static host_alias="$host_alias" host="$host" +# The archiver. +AR='$AR' + # The linker used to build libraries. LD='$LD' @@ -845,6 +857,9 @@ pic_flag='$pic_flag' # Compiler flag to prevent dynamic linking. 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: profile_flag_pattern='$profile_flag_pattern' @@ -884,6 +899,9 @@ hardcode_action=$hardcode_action # This must work even if \$libdir does not exist. 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 # resulting binary. hardcode_direct=$hardcode_direct diff --git a/ltmain.sh.in b/ltmain.sh.in index 5a91f568..9c4d73ea 100644 --- a/ltmain.sh.in +++ b/ltmain.sh.in @@ -155,13 +155,16 @@ if test -z "$show_help"; then *rm) mode=uninstall ;; + *.la) + mode=dlname + ;; *) # Just use the default operation mode. if test "$mode" = NONE; 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 - 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 ;; @@ -176,6 +179,7 @@ if test -z "$show_help"; then case "$mode" in # libtool compile mode compile) + progname="$progname: compile" # Get the compilation command and the source file. base_compile="$nonopt" lastarg= @@ -271,6 +275,7 @@ if test -z "$show_help"; then # libtool link mode link) + progname="$progname: link" # Go through the arguments, transforming them on the way. cc="$nonopt" args="$cc" @@ -279,6 +284,8 @@ if test -z "$show_help"; then compile_shlibpath= finalize_shlibpath= deplibs= + export_dynamic=no + hardcode_libdirs= install_libdir= libobjs= link_against_libtool_libs= @@ -290,14 +297,7 @@ if test -z "$show_help"; then prevarg= temp_rpath= vinfo= - - -# 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 + whole_archive=no # We need to know -static, to get the right output filenames. case " $@ " in @@ -310,13 +310,8 @@ if test -z "$show_help"; then if test -n "$prev"; then case "$prev" in output) - if test "$build_libtool_libs" = yes; then - compile_command="$compile_command $objdir/$arg" - finalize_command="$finalize_command $objdir/$arg"T - else - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" args="$args $arg" ;; esac @@ -331,6 +326,13 @@ if test -z "$show_help"; then prevarg="$arg" case "$arg" in + -export-dynamic) + export_dynamic=yes + compile_command="$compile_command $export_dynamic_flag" + finalize_command="$finalize_command $export_dynamic_flag" + continue + ;; + -L*) dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'` case "$dir" in @@ -346,6 +348,8 @@ if test -z "$show_help"; then -l*) deplibs="$deplibs $arg" ;; + -no-whole-archive) whole_archive=no ;; + -o) prev=output ;; -rpath) @@ -370,13 +374,53 @@ if test -z "$show_help"; then continue ;; + -whole-archive) whole_archive=yes ;; + -*) cc="$cc $arg" ;; # Some other compiler flag. - *.o | *.a) + *.o) # A standard object. 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) # A library object. libobjs="$libobjs $arg" @@ -439,9 +483,23 @@ if test -z "$show_help"; then fi if test -n "$hardcode_libdir_flag_spec"; then - hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"` - compile_command="$compile_command $hardcode_libdir_flag" - finalize_command="$finalize_command $hardcode_libdir_flag" + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + # 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 "$libdir"; then + hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"` + compile_command="$compile_command $hardcode_libdir_flag" + finalize_command="$finalize_command $hardcode_libdir_flag" + fi fi case "$hardcode_action" in @@ -500,8 +558,9 @@ if test -z "$show_help"; then fi else # Transform directly to old archives if we don't build new libraries. - compile_command="$compile_command $dir/$old_library" - finalize_command="$finalize_command $dir/$old_library" + test -z "$old_library" || linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" fi continue ;; @@ -523,6 +582,12 @@ if test -z "$show_help"; then exit 1 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= oldobjs= case "$output" in @@ -539,6 +604,7 @@ if test -z "$show_help"; then *.a) # Old archive. + libname=`echo "$output" | sed 's/\.a$//'` build_old_libs=yes if test -n "$install_libdir"; then @@ -553,14 +619,22 @@ if test -z "$show_help"; then *.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 - 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 fi # How the heck are we supposed to write a wrapper for a shared library? 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 fi @@ -569,10 +643,6 @@ if test -z "$show_help"; then exit 1 fi - current=0 - revision=0 - age=0 - # Parse the version information argument. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' set dummy $vinfo @@ -711,6 +781,12 @@ if test -z "$show_help"; then $show "$ln_s $realname $link" $run $ln_s $realname $link || exit $? 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 ;; @@ -750,8 +826,10 @@ if test -z "$show_help"; then # Delete the old objects. $run $rm $obj $libobj - # Create the old-style object. - reload_objs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` + # Create the old-style object (skipping any convenience libraries). + # 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" cmds=`eval echo \"$reload_cmds\"` @@ -801,14 +879,11 @@ if test -z "$show_help"; then compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'` fi - # Create the binary in the object directory, then wrap it. - if test -d $objdir; then : - else - $show "$mkdir $objdir" - $run $mkdir $objdir || exit $? - fi - 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. $show "$compile_command" $run $compile_command @@ -825,6 +900,17 @@ if test -z "$show_help"; then exit $status 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. + if test -d $objdir; then : + else + $show "$mkdir $objdir" + $run $mkdir $objdir || exit $? + fi + if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= @@ -948,19 +1034,21 @@ EOF # See if we need to build an old-fashioned archive. if test "$build_old_libs" = "yes"; then - # Transform .lo files to .o - oldobjs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` - case "$output" in - *.la) - # Now set the variables for building old libraries. - oldlib="$objdir/$libname.a" - ;; - *) - oldlib="$output" + # Now set the variables for building old libraries. + oldlib="$objdir/$libname.a" + + # Transform .lo files to .o (skipping convenience libraries). + # FIXME: skipping them is simplistic. We should determine which members + # are actually needed to resolve symbols. + oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'` + + if test -d "$objdir"; then $show "$rm $oldlib" $run $rm $oldlib - ;; - esac + else + $show "$mkdir $objdir" + $run $mkdir $objdir + fi # Do each command in the archive commands. cmds=`eval echo \"$old_archive_cmds\"` @@ -971,6 +1059,38 @@ EOF eval "$run $cmd" || exit $? done 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 # Now create the libtool archive. @@ -993,6 +1113,9 @@ library_names='$library_names' # The name of the static archive. old_library='$old_library' +# The name that we can dlopen(3). +dlname='$dlname' + # Version information for $libname. current=$current age=$age @@ -1009,6 +1132,7 @@ EOF # libtool install mode install) + progname="$progname: install" # The first argument is the name of the installation program. install_prog="$nonopt" @@ -1151,6 +1275,7 @@ EOF # Install the shared library and build the symlinks. $show "$install_prog $dir/$realname $destdir/$realname" eval "$run $install_prog $dir/$realname $destdir/$realname" || exit $? + test "X$dlname" = "X$realname" && dlname= # Support stripping libraries. if test -n "$stripme"; then @@ -1175,11 +1300,18 @@ EOF # ... and create new ones. for linkname do + test "X$dlname" = "X$linkname" && dlname= $show "$ln_s $realname $destdir/$linkname" $run $ln_s $realname $destdir/$linkname done 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. lib="$destdir/$realname" cmds=`eval echo \"$postinstall_cmds\"` @@ -1273,15 +1405,6 @@ EOF esac 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 name=`echo "$file" | sed 's%^.*/%%'` @@ -1326,8 +1449,51 @@ EOF 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 finish) + progname="$progname: finish" libdirs="$nonopt" if test -n "$finish_cmds" && test -n "$libdirs"; then @@ -1359,6 +1525,7 @@ EOF # libtool uninstall mode uninstall) + progname="$progname: uninstall" rm="$nonopt" files= @@ -1381,6 +1548,8 @@ EOF test "$dir" = "$file" && dir=. name=`echo "$file" | sed -e 's%^.*/%%'` + rmfiles="$file" + case "$name" in *.la) # Possibly a libtool archive, so verify it. @@ -1389,21 +1558,19 @@ EOF # Delete the libtool libraries and symlinks. for n in $library_names; do - $show "$rm $dir/$n" - $run $rm $dir/$n + rmfiles="$rmfiles $dir/$n" + test "X$n" = "X$dlname" && dlname= done + test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" - # Delete the old-fashioned archive. - if test -n "$old_library"; then - $show "$rm $dir/$old_library" - $run $rm $dir/$old_library - fi + # FIXME: should reinstall the best remaining shared library. fi ;; esac - $show "$rm $file" - $run $rm $file + $show "$rm $rmfiles" + $run $rm $rmfiles done exit 0 ;; @@ -1437,6 +1604,7 @@ Provide generalized library-building support services. MODE must be one of the following: 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 install install libraries or executables link create a library or an executable @@ -1462,6 +1630,19 @@ library object suffix, \`.lo'. EOF ;; +dlname) + cat < + + * Makefile.am (TESTS): Do the full make sequence with + --disable-shared, then without. + + * demo-sttc.test: Configure the demo directory with + --disable-shared. + +Wed Jan 29 14:02:03 1997 Gordon Matzigkeit + + * hardcode.test: Rewrite to use fgrep on output from ``strings + -a'' if using fgrep directly on the binary files fails. From Mark + Kettenis. + +Tue Jan 28 14:00:23 1997 Gordon Matzigkeit + + * hardcode.test: Make sure that ../demo/libhello.la really is a + shared library before running hardcoding tests. + Sat Jan 18 10:33:21 1997 Gordon Matzigkeit * demo-conf.test: Use the CONFIG_SHELL environment variable when diff --git a/tests/Makefile.am b/tests/Makefile.am index 54267429..4b1001e9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,9 +2,10 @@ AUTOMAKE_OPTIONS = gnits -TESTS = demo-conf.test demo-make.test demo-exec.test demo-inst.test \ - demo-unst.test hardcode.test link.test link-2.test suffix.test \ - test-e.test +makesequence = demo-make.test demo-exec.test \ + demo-inst.test demo-unst.test hardcode.test +TESTS = demo-conf.test $(makesequence) \ + link.test link-2.test suffix.test test-e.test EXTRA_DIST = defs tlibtool $(TESTS) diff --git a/tests/defs b/tests/defs index fbb6cc58..13337515 100644 --- a/tests/defs +++ b/tests/defs @@ -8,15 +8,17 @@ case "$srcdir" in *) srcdir=`cd $srcdir && pwd` ;; esac +# tlibtool needs to know what srcdir is. +export srcdir +libtool="$srcdir/tlibtool" + prefix="./=inst" -if test -d $prefix; then - rm -rf $prefix -fi if test "$need_prefix" = yes; then # An absolute path to a test installation directory. - mkdir $prefix + test -d $prefix || mkdir $prefix prefix=`cd $prefix && pwd` else + test -d $prefix && rm -rf $prefix prefix=NONE fi diff --git a/tests/demo-conf.test b/tests/demo-conf.test index e648e682..0e0f2197 100755 --- a/tests/demo-conf.test +++ b/tests/demo-conf.test @@ -18,8 +18,8 @@ cd ../demo || exit 1 # Possibly clean up the distribution. if test -f config.cache; then - echo "= Running make distclean in ../demo" - make distclean || rm -f config.cache + echo "= Running $make distclean in ../demo" + $make distclean || rm -f config.cache fi # Configure the demonstration. diff --git a/tests/demo-exec.test b/tests/demo-exec.test index 488e0fbb..73cdb069 100755 --- a/tests/demo-exec.test +++ b/tests/demo-exec.test @@ -4,7 +4,8 @@ # Test script header. need_prefix=no if test -z "$srcdir"; then - srcdir=. + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. test "${VERBOSE+set}" != "set" && VERBOSE=yes fi . $srcdir/defs || exit 1 diff --git a/tests/demo-inst.test b/tests/demo-inst.test index 34b75f69..832eae3e 100755 --- a/tests/demo-inst.test +++ b/tests/demo-inst.test @@ -20,8 +20,8 @@ fi # Change to our build directory. cd ../demo || exit 1 -echo "= Running make install in ../demo" -make install || exit 1 +echo "= Running $make install in ../demo" +$make install || exit 1 echo "= Executing installed programs" if $prefix/bin/hell.static | grep 'GNU Hell'; then : diff --git a/tests/demo-make.test b/tests/demo-make.test index 9f9bf8dc..cdbed8f0 100755 --- a/tests/demo-make.test +++ b/tests/demo-make.test @@ -4,7 +4,8 @@ # Test script header. need_prefix=no if test -z "$srcdir"; then - srcdir=. + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. test "${VERBOSE+set}" != "set" && VERBOSE=yes fi . $srcdir/defs || exit 1 diff --git a/tests/demo-unst.test b/tests/demo-unst.test index 693ea1bd..d2e3c879 100755 --- a/tests/demo-unst.test +++ b/tests/demo-unst.test @@ -4,7 +4,8 @@ # Test script header. need_prefix=yes if test -z "$srcdir"; then - srcdir=. + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. test "${VERBOSE+set}" != "set" && VERBOSE=yes fi . $srcdir/defs || exit 1 @@ -23,7 +24,8 @@ echo "= Running make uninstall in ../demo" make uninstall || exit 1 # See that there were no files leftover in $prefix. -leftovers=`find $prefix ! -type d -print` +# Ignore dotfiles, so that .nfsXXX files don't screw up the test. +leftovers=`find $prefix ! -type d -print | egrep -v '^\.'` if test -n "$leftovers"; then echo "= Leftover after make uninstall:" ls -l $leftovers diff --git a/tests/demo.test b/tests/demo.test index 713a612f..25b0ce8d 100644 --- a/tests/demo.test +++ b/tests/demo.test @@ -29,23 +29,51 @@ $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix || exit 1 echo "= Running make in ../demo" make || exit 1 -echo "= Running make check in ../demo" -make check || exit 1 +# Try running the program. +echo "= Executing uninstalled programs" +if ./hell.static | grep 'GNU Hell'; then : +else + echo "$0: cannot execute ./hell.static" 1>&2 + exit 1 +fi + +if ./hell | grep 'GNU Hell'; then : +else + echo "$0: cannot execute ./hell" 1>&2 + exit 1 +fi echo "= Running make install in ../demo" make install || exit 1 -# FIXME - only fail with installcheck if we are superuser. -echo "= Running make installcheck in ../demo" -make installcheck || exit 1 +echo "= Executing installed programs" +if $prefix/bin/hell.static | grep 'GNU Hell'; then : +else + echo "$0: cannot execute $prefix/bin/hell.static" 1>&2 + exit 1 +fi + +if $prefix/bin/hell | grep 'GNU Hell'; then : +else + echo "$0: warning: cannot execute $prefix/bin/hell" 1>&2 +fi echo "= Running make uninstall in ../demo" make uninstall || exit 1 -# Clean up the distribution. -make distclean +# See that there were no files leftover in $prefix. +leftovers=`find $prefix ! -type d -print` +if test -n "$leftovers"; then + echo "= Leftover after make uninstall:" + ls -l $leftovers + exit 1 +fi # Delete the directory tree we created. rm -rf $prefix + +# Clean up the distribution. +make distclean + exit 0 diff --git a/tests/hardcode.test b/tests/hardcode.test index f7b54d82..50522af9 100755 --- a/tests/hardcode.test +++ b/tests/hardcode.test @@ -20,6 +20,18 @@ fi # Change to our build directory. cd ../demo || exit 1 +# Check to make sure we have a dynamic library. +library_names=NONE +eval `egrep -e '^library_names=' ./libhello.la 2>/dev/null` + +if test "$library_names" = NONE; then + echo "library_names not set in ../demo/libhello.la" 1>&2 + exit 1 +elif test -z "$library_names"; then + echo "= Exiting: ../demo/libhello.la is not a shared library" + exit 0 +fi + echo "= Running $make hardcode in ../demo" $make hardcode || exit 1 @@ -56,33 +68,50 @@ for file in hc-*; do hc-libpath) expected="$hardcode_shlibpath_var" ;; hc-minusL) expected="$hardcode_minus_L" ;; *) - echo "unknown file \`$file'" 1>&2 continue ;; esac + # Discover whether the .libs directory really was hardcoded. + hardcoded=no if fgrep '.libs' $file > /dev/null; then + hardcoded=yes + elif strings -a $file 2>/dev/null | fgrep '.libs' > /dev/null; then + # At least AIX fgrep doesn't work for binary files, so we need strings. + hardcoded=yes + elif egrep 'unsupported' $file > /dev/null; then + hardcoded=unsupported + fi + + # Check the result. + case "$hardcoded" in + yes) if test $expected = yes; then echo ".libs was hardcoded in \`$file', as libtool expected" else echo ".libs was hardcoded in \`$file', which fooled libtool" 1>&2 status=1 fi - elif egrep 'unsupported' $file > /dev/null; then - if test $expected = unsupported; then - echo "\`$file' was not linked properly, as libtool expected" - else - echo "\`$file' was not linked properly, which fooled libtool" 1>&2 - status=1 - fi - else + ;; + + no) if test $expected = no; then echo ".libs was not hardcoded in \`$file', as libtool expected" else echo ".libs was not hardcoded in \`$file', which fooled libtool" 1>&2 status=1 fi - fi + ;; + + unsupported) + if test $expected = unsupported; then + echo "\`$file' was not linked properly, as libtool expected" + else + echo "\`$file' was not linked properly, which fooled libtool" 1>&2 + status=1 + fi + ;; + esac done exit $status diff --git a/tests/link-2.test b/tests/link-2.test index f4d38edd..6de9af14 100755 --- a/tests/link-2.test +++ b/tests/link-2.test @@ -1,16 +1,17 @@ #! /bin/sh -# link.test - check that .lo files and .l_o files aren't made into programs. +# link.test - check that .lo files aren't made into programs. # Test script header. need_prefix=no if test -z "$srcdir"; then - srcdir=. + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. test "${VERBOSE+set}" != "set" && VERBOSE=yes fi . $srcdir/defs || exit 1 # Try a sample link command. -linkresult=`$libtool -n --mode=link gcc -o something foo.o hello.l_o hell.lo` +linkresult=`$libtool -n --mode=link gcc -o something foo.o hell.lo` test $? = 0 || exit 1 @@ -20,10 +21,5 @@ case "$linkresult" in echo "$0: .lo files should not be linked into programs" exit 1 ;; - -*".l_o "*) - echo "$0: .l_o files should not be linked into programs" - exit 1 - ;; esac exit 0 diff --git a/tests/link.test b/tests/link.test index 6257d5b1..749eab5d 100755 --- a/tests/link.test +++ b/tests/link.test @@ -4,7 +4,8 @@ # Test script header. need_prefix=no if test -z "$srcdir"; then - srcdir=. + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. test "${VERBOSE+set}" != "set" && VERBOSE=yes fi . $srcdir/defs || exit 1