From: Gordon Matzigkeit Date: Tue, 1 Apr 1997 19:18:28 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release-1-0a~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=985a175c64eee9d02edc85ed93704348ced9e1aa;p=thirdparty%2Flibtool.git *** empty log message *** --- diff --git a/ChangeLog b/ChangeLog index 56dcb24bf..10a11b162 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,68 @@ +Mon Mar 24 01:26:48 1997 Gordon Matzigkeit + + * ltmain.sh.in: Linking with -static should link against the old + library, not linklib. + + * README-automake: Updated to point to Automake 1.1m. + +Sat Mar 15 14:15:43 1997 Gordon Matzigkeit + + * demo/main.c: Use it. + + * demo/foo.h: Declare it. + + * demo/foo.c: Added definition of `nothing' so that we have an + global variable definition, as well as functions. + +Wed Mar 12 19:00:44 1997 Gordon Matzigkeit + + * ltconfig.in: Make sure either enable_shared or enable_static is + configured. Reported by Tom Tromey. + + * ltmain.sh.in: Bomb out if no library types are configured. + +Sat Feb 22 12:47:59 1997 Gordon Matzigkeit + + * ltconfig.in, ltmain.sh.in (hardcode_libdir_flag_spec): Renamed + from `hardcode_libdir_flag'. + (library_names_spec): Renamed from `lib_names'. + + * ltconfig.in, ltmain.sh.in (hardcode_action): Change value from + `rpath' to `immediate'. + + * replfunc.m4: Add AM_FUNC_ALLOCA, AM_FUNC_MEMCMP, and + AM_STRUCT_ST_BLOCKS. + +Tue Feb 18 09:36:24 1997 Gordon Matzigkeit + + * ltconfig.in: Transform *-*-linux* to *-*-linux-gnu* to support + old-style config.guess scripts. + +Mon Feb 17 23:30:32 1997 Gordon Matzigkeit + + * ltmain.sh.in: Create objdir *before* linking a program into it. + +Wed Feb 12 01:20:45 1997 Gordon Matzigkeit + + * ltconfig.in: Any ld --version that returns GNU is probably a GNU + ld. From Marcus Daniels. + + * libtool.m4: Added AM_REPLACE_FUNCS. + +Tue Feb 11 01:28:19 1997 Gordon Matzigkeit + + * ltconfig.in: Trivial port to *-*-osf4. From Bruno Haible. + +Mon Feb 10 09:54:07 1997 Gordon Matzigkeit + + * ltconfig.in: AIX 3 and 4 ld only hardcodes LIBPATH if -L is not + specified. This behaviour is the same with both xlc and gcc. + +Fri Feb 7 08:37:54 1997 Gordon Matzigkeit + + * doc/platforms.texi: Yaay! We found a workaround for HP-UX + /bin/sh buffer overflows. From Eric Backus. + Mon Feb 3 11:15:01 1997 Gordon Matzigkeit * Release 0.9. diff --git a/Makefile.am b/Makefile.am index d2863973f..a0eb18fa3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,16 +3,19 @@ AUTOMAKE_OPTIONS = gnits SUBDIRS = doc tests +aclocal_macros = libtool.m4 replfunc.m4 + # Distribute ltconfig and ltmain.sh so that the demo directory works. -EXTRA_DIST = libtool.m4 libtoolize.in ltconfig ltconfig.in \ +EXTRA_DIST = $(aclocal_macros) libtoolize.in ltconfig ltconfig.in \ ltmain.sh ltmain.sh.in README-automake CLEANFILES = libtool libtoolize MAINTAINERCLEANFILES = ltconfig ltmain.sh # Files in the demo subdirectory that go in the distribution. -demo_distfiles = Makefile.in Makefile.am README acinclude.m4 aclocal.m4 \ - configure configure.in foo.c foo.h hello.c main.c \ - run.test +demo_distfiles = demo/Makefile.in demo/Makefile.am demo/README \ + demo/acinclude.m4 demo/aclocal.m4 \ + demo/configure demo/configure.in demo/foo.c demo/foo.h \ + demo/hello.c demo/main.c demo/run.test # These are required by libtoolize. pkgdata_SCRIPTS = config.guess config.sub ltconfig @@ -20,7 +23,7 @@ pkgdata_DATA = ltmain.sh # This macro file should be visible to Automake's aclocal. aclocaldir = @aclocaldir@ -aclocal_DATA = libtool.m4 +aclocal_DATA = $(aclocal_macros) # The standalone libtool script, and the libtool distributor. bin_SCRIPTS = libtool libtoolize @@ -42,15 +45,32 @@ $(srcdir)/ltmain.sh: ltmain.sh.in configure.in CONFIG_FILES=ltmain.sh CONFIG_HEADERS= $(top_builddir)/config.status # Distribute the demo subdirectory. -dist-hook: +dist-hook: $(demo_distfiles) mkdir $(distdir)/demo -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 @for file in $(demo_distfiles); do \ - d=$(srcdir)/demo; \ - test -f $(distdir)/demo/$$file \ - || ln $$d/$$file $(distdir)/demo/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/demo/$$file; \ + d=$(srcdir); \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ done + +# All our rules should depend on these demo files. +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 + +$(srcdir)/demo/configure: demo/configure.in demo/aclocal.m4 + cd $(srcdir)/demo && autoconf + +$(srcdir)/demo/aclocal.m4: demo/configure.in demo/acinclude.m4 + cd $(srcdir)/demo && aclocal + +$(srcdir)/demo/acinclude.m4: + rm -f $(srcdir)/demo/acinclude.m4 + ln -s ../libtool.m4 $(srcdir)/demo/acinclude.m4 diff --git a/NEWS b/NEWS index a735dcdb7..d371dcbbc 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -New in 0.7c: +New in 0.8: * Bug fixes, and more documentation. * Basic support for other language compilers (C++, Fortran, and preprocessed assembler). diff --git a/README b/README index 3e687dc8b..8d8bac1a3 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ This is GNU libtool, a generic library support script. Libtool hides -the complexity of generating special library types (such as shared -libraries) behind a consistent interface. +the complexity of using shared libraries behind a consistent +interface. To use libtool, add the new generic library building commands to your Makefile, Makefile.in, or Makefile.am. See the documentation for @@ -9,19 +9,19 @@ details. Libtool supports building static libraries on all platforms. Shared library support has been implemented for these platforms: + AIX 3.x (*-*-aix3*) AIX 4.x (*-*-aix4*) + Digital/UNIX 3.x, a.k.a. OSF/1 (*-*-osf3*) FreeBSD 2.x (*-*-freebsd*) + HP-UX 9.x, 10.x (*-*-hpux9*, *-*-hpux10*) + IRIX 5.x, 6.x (*-*-irix5*, *-*-irix6*) + Linux ELF targets (*-*-linux*, except *-*-linuxaout* and *-*-linuxoldld*) NetBSD 1.x (*-*-netbsd*) + SCO OpenServer 5.x (*-*-sco3.2v5*) [FIXME: in progress] + Solaris 1.x, a.k.a. SunOS 4.x (*-*-sunos4*) Solaris 2.x (*-*-solaris2*) - Linux ELF targets (*-*-linux*, except *-*-linuxaout* and *-*-linuxoldld*) All ELF targets that use both the GNU C compiler (gcc) and GNU ld -Shared library support is implemented, but untested on: - AIX 3.x (*-*-aix3*) - Digital/UNIX 3.x, a.k.a. OSF/1 (*-*-osf3*) - HP-UX 10.x (*-*-hpux10*) - Solaris 1.x, a.k.a. SunOS 4.x (*-*-sunos4*) - See the file NEWS for a description of recent changes to libtool. See the file INSTALL for instructions on how to build and install libtool. diff --git a/THANKS b/THANKS index e5933274e..79ec4866d 100644 --- a/THANKS +++ b/THANKS @@ -1,12 +1,13 @@ Libtool would not be what it is today without the invaluable help of these people: +Bruno Haible +Charles S. Kerr Joel Cannon Karl Berry Mimi Burbank Oliver Guntermann Thomas Esser -Charles S. Kerr Tom Tromey Ulrich Drepper Volker Kuhlmann diff --git a/TODO b/TODO index 4678f2b00..edcaf4150 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,3 @@ -For 1.0: - -* Finish documenting shared library systems. Ugh. I'll need more -primary documentation in order to do this well. - For 1.1: * Write libtool not to be dependent on the compiler used to configure @@ -29,10 +24,4 @@ partially driven by the needs of packaging tools, such as RPM and dpkg. * Add support for windoze DLL's. Check out Lesstif and Tcl -configuration again. - -* What should be done about the difference between -fpic and -fPIC? -Probably nothing. - -* GCC docs imply that all rs6000 code is PIC. See if it is really -true of any other processors: at least powerpc, powerpcle. +configuration again. The Cygnus win32 project may also be of value. diff --git a/configure.in b/configure.in index 223827c0a..8c82e0a5c 100644 --- a/configure.in +++ b/configure.in @@ -1,11 +1,9 @@ AC_INIT(ltmain.sh.in) -AM_INIT_AUTOMAKE(libtool, 0.8) +AM_INIT_AUTOMAKE(libtool, 0.9) pkgdatadir='${datadir}/libtool' AC_SUBST(pkgdatadir) aclocaldir='${datadir}/aclocal' AC_SUBST(aclocaldir) -localedir='${datadir}/locale' -AC_SUBST(localedir) AC_OUTPUT([Makefile doc/Makefile tests/Makefile]) diff --git a/demo/Makefile.am b/demo/Makefile.am index c64e67357..e6de4a687 100644 --- a/demo/Makefile.am +++ b/demo/Makefile.am @@ -1,5 +1,5 @@ # A brief demonstration of using Automake with Libtool. -AUTOMAKE_OPTIONS = ansi2knr foreign +AUTOMAKE_OPTIONS = foreign EXTRA_DIST = $(TESTS) acinclude.m4 @@ -37,13 +37,9 @@ $(srcdir)/acinclude.m4: hardcode: $(hardcode_tests) hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) @shlib=./.libs/libhello.a; \ - libs=`ls ./.libs/libhello.*`; \ - for lib in $$libs; do \ - case "$$lib" in \ - *.a) ;; \ - *) shlib="$$lib"; \ - break ;; \ - esac; \ + eval "`egrep '^library_names' libhello.la`"; \ + for lib in $$library_names; do \ + shlib="./.libs/$$lib"; \ done; \ echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS)"; \ eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS)" @@ -53,5 +49,5 @@ hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES) hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) @eval `egrep -e '^shlibpath_var=' ./libtool`; \ - echo "$$shlibpath_var=./.libs $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS)"; \ - eval "$$shlibpath_var=./.libs $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS)" + echo "$$shlibpath_var=./.libs $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) || echo unsupported > $@"; \ + eval "$$shlibpath_var=./.libs $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) || echo unsupported > $@" diff --git a/demo/foo.c b/demo/foo.c index e95e8065d..17bf8ba64 100644 --- a/demo/foo.c +++ b/demo/foo.c @@ -19,9 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Written by Gordon Matzigkeit */ #include "foo.h" -static char *package = PACKAGE; -static char *version = VERSION; - int foo (void) { diff --git a/doc/Makefile.am b/doc/Makefile.am index e0fafe1ee..e1e919eb9 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -6,16 +6,4 @@ ## ## Written by Gordon Matzigkeit AUTOMAKE_OPTIONS = gnits - -CLEANFILES = aclibtool.T -MAINTAINERCLEANFILES = aclibtool.texi - info_TEXINFOS = libtool.texi -libtool_TEXINFOS = aclibtool.texi - -## Quoted version of $(top_srcdir)/libtool.m4. -$(srcdir)/aclibtool.texi: $(top_srcdir)/libtool.m4 - rm -f aclibtool.T - sed -e 's/{/@{/g' -e 's/}/@}/g' $(top_srcdir)/libtool.m4 \ - > aclibtool.T - mv aclibtool.T $(srcdir)/aclibtool.texi diff --git a/doc/libtool.texi b/doc/libtool.texi index 573ee46af..bf0a6daa9 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -95,6 +95,7 @@ version @value{VERSION}. * 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. * Index:: Index of concepts, variables, and programs. --- The Detailed Node Listing --- @@ -158,6 +159,7 @@ Using Libtool with Other Languages Maintainance Notes for Libtool * New Ports:: How to port libtool to new systems. +* Tested Platforms:: When libtool was last tested. * Platform Quirks:: Information about different library systems. * libtool Script Contents:: Configuration information that libtool uses. @@ -168,6 +170,16 @@ Platform Quirks * Shared Libraries:: Shared library implementations. * 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 menu @end ifinfo @@ -1705,10 +1717,7 @@ libtool, you may still be able to use it with libtool. FIXME tell how to skip the libtool --mode=compile stage and keep going -If all else fails, send electronic mail to @value{MAINT}, and ask for -help in adding support for your language. - -@node Maintaining, Index, Other Languages, Top +@node Maintaining, Troubleshooting, Other Languages, Top @comment node-name, next, previous, up @chapter Maintainance Notes for Libtool @@ -1718,11 +1727,12 @@ porting libtool to new systems, or writing your own libtool. @menu * New Ports:: How to port libtool to new systems. +* Tested Platforms:: When libtool was last tested. * Platform Quirks:: Information about different library systems. * libtool Script Contents:: Configuration information that libtool uses. @end menu -@node New Ports, Platform Quirks, Maintaining, Maintaining +@node New Ports, Tested Platforms, Maintaining, Maintaining @comment node-name, next, previous, up @section Porting libtool to New Systems @@ -1752,7 +1762,23 @@ Some systems have special documentation on how to build and install shared libraries. @end table -@node Platform Quirks, libtool Script Contents, New Ports, Maintaining +@node Tested Platforms, Platform Quirks, New Ports, Maintaining +@comment node-name, next, previous, up +@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: + +@example +@include ../PLATFORMS +@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 @section Platform Quirks @@ -2006,7 +2032,140 @@ 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, , Maintaining, Top +@node Troubleshooting, Index, Maintaining, Top +@comment node-name, next, previous, up +@chapter Troubleshooting + +Libtool is under constant development, changing to keep up-to-date with +new operating systems. If libtool doesn't work the way you think it +should on your platform, you should read this chapter to help determine +what the problem is, and how to resolve it. + +@menu +* Libtool Test Suite:: Libtool's self-tests. +* Reporting Bugs:: How to report problems with libtool. +@end menu + +@node Libtool Test Suite, Reporting Bugs, Troubleshooting, Troubleshooting +@comment node-name, next, previous, up +@section The Libtool Test Suite + +Libtool comes with its own set of programs that test its capabilities, +and report obvious bugs in the libtool program. These tests, too, are +constantly evolving, based on past problems with libtool, and known +deficiencies in other operating systems. + +As described in the @file{INSTALL} file, you may run @kbd{make check} +after you have built libtool (possibly before you install it) in order +to make sure that it has the functionality demanded by the test +programs. + +@menu +* Test Descriptions:: The contents of the test suite. +* 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 +@subsection Description of Test Suite + +Here is a list of the current programs in the test suite, and what they +test for: + +@table @file +@item demo-conf.test +@itemx demo-exec.test +@itemx demo-inst.test +@itemx demo-make.test +@itemx demo-unst.test +These programs check to see that the @file{demo} subdirectory of the +libtool distribution can be configured, built, installed, and +uninstalled correctly. + +The @file{demo} subdirectory contains a demonstration of a trivial +package that uses libtool. + +@item hardcode.test +On all systems with shared libraries, the location of the library can be +encoded in executables that are linked against it @pxref{Linking +Executables}. This test checks the conditions under which your system +linker hardcodes the library location, and guarantees that they +correspond to libtool's own notion of how your linker behaves. + +@item link.test +This test guarantees that linking directly against a non-libtool static +library works properly. + +@item link-2.test +This test makes sure that files ending in @samp{.lo} are never linked +directly into a program file. + +@item suffix.test +When other programming languages are used with libtool (@pxref{Other +Languages}), the source files may end in suffixes other than @samp{.c}. +This test validates that libtool can handle suffixes for all the file +types that it supports, and that it fails when the suffix is invalid. + +@item test-e.test +This program checks that the @code{test -e} construct is @emph{never} in +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 +@subsection When Tests Fail + +Each of the above tests are designed to produce no output when they are +run via @kbd{make check}. The exit status of each program tells the +Makefile whether or not the test succeeded. + +If a test fails, it means that there is either a programming error in +libtool, or in the test itself. + +To investigate a particular test, you may run it directly, as you would +a normal program. When the test is invoked in this way, it produces +output which may be useful in determining what the problem is. + +Another way to have the test programs produce output is to set the +@var{VERBOSE} environment variable to @samp{yes} before running them. +For example, @kbd{make check VERBOSE=yes} 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 +@section Reporting Bugs + +If you think you have discovered a bug in libtool, you should think +twice: the libtool maintainer is notorious for passing the buck (or +maybe that should be ``passing the bug''). + +Libtool was invented to fix known deficiencies in shared library +implementations, so, in a way, most of the bugs in libtool are actually +bugs in other operating systems. + +However, the libtool maintainer would definitely be happy to add support +for somebody else's buggy operating system. (I wish there was a way to +do winking smiley-faces in texinfo). + +Genuine bugs in libtool include problems with shell script portability, +documentation errors, and failures in the test suite (@pxref{Libtool +Test Suite}). + +First, check the documentation and help screens to make sure that the +behaviour you think is a problem is not already mentioned. + +Then, you should read the Emacs guide to reporting bugs (@pxref{Bugs, , The +Emacs Manual, emacs.info, The Emacs Manual}). Some of the details +listed there are specific to Emacs, but the priciple behind them is a +general one. + +Finally, send a bug report to the libtool maintainer (@value{MAINT}), +with any appropriate @emph{facts}, such as test suite output +(@pxref{When Tests Fail}), all the details needed to reproduce the bug, +and a brief description of why you think the behaviour is a bug. + +@node Index, , Troubleshooting, Top @comment node-name, next, previous, up @unnumbered Index diff --git a/libtoolize.in b/libtoolize.in index f6bc8f9e0..7b0795984 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -125,6 +125,12 @@ if test -z "$automake"; then echo "Using \`AC_PROG_RANLIB' is rendered obsolete by \`AM_PROG_LIBTOOL'" fi + if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then + updatemsg="You should update your \`aclocal.m4' by running aclocal." + else + updatemsg="You should add the contents of \`$libtool_m4' to \`aclocal.m4'." + fi + if egrep '^AC_DEFUN\(AM_PROG_LIBTOOL' aclocal.m4 >/dev/null 2>&1; then # Check the version number on libtool.m4 and the one used in aclocal.m4. instserial=`grep '^# serial ' $libtool_m4 | grep 'AM_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` @@ -138,13 +144,13 @@ if test -z "$automake"; then test -z "$localserial" && localserial=0 if test "$localserial" -lt "$instserial"; then - echo "You should update \`aclocal.m4' with the contents of \`$libtool_m4'" + echo "$updatemsg" elif test "$localserial" -gt "$instserial"; then echo "$progname: \`$libtool_m4' has serial number $instserial, less than $localserial found in \`aclocal.m4'" 1>&2 fi fi else - echo "Add the contents of \`$libtool_m4' to \`aclocal.m4'." + echo "$updatemsg" fi fi diff --git a/ltconfig.in b/ltconfig.in index 25f86aeca..cc2a96ca5 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -484,7 +484,7 @@ echo $ac_t "$with_gnu_ld" 1>&6 echo $ac_n "checking if $linker supports shared libraries... $ac_c" 1>&6 archive_cmds= -link_rpath_flag= +hardcode_libdir_flag= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported @@ -511,20 +511,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' - link_rpath_flag='${wl}-rpath $wl$libdir' + hardcode_libdir_flag='${wl}-rpath $wl$libdir' fi else # PORTME fill in a description of your system's linker (not GNU ld) case "$host" in *-*-aix3*) - archive_cmds='$rm $lib.exp;/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' - hardcode_direct=yes + 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' + test "$with_gcc" != yes && hardcode_direct=yes hardcode_minus_L=yes ;; *-*-aix4*) - archive_cmds='$rm $lib.exp;/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' - hardcode_direct=yes + 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' + test "$with_gcc" != yes && hardcode_direct=yes hardcode_minus_L=yes ;; @@ -537,34 +537,34 @@ else *-*-hpux9*) archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib' - link_rpath_flag='${wl}+b ${wl}$libdir' + hardcode_libdir_flag='${wl}+b ${wl}$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; *-*-hpux10*) archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' - link_rpath_flag='${wl}+b ${wl}$libdir' + hardcode_libdir_flag='${wl}+b ${wl}$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; *-*-irix5* | *-*-irix6*) archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' - link_rpath_flag='${wl}-rpath ${wl}$libdir' + hardcode_libdir_flag='${wl}-rpath ${wl}$libdir' ;; *-*-netbsd*) # Tested with NetBSD 1.2 ld archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' - link_rpath_flag='-R$libdir' + hardcode_libdir_flag='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; *-*-osf3*) archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' - link_rpath_flag='${wl}-rpath ${wl}$libdir' + hardcode_libdir_flag='${wl}-rpath ${wl}$libdir' ;; *-*-sco3.2v5*) @@ -574,13 +574,13 @@ else *-*-solaris2*) archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' - link_rpath_flag='-R$libdir' + hardcode_libdir_flag='-R$libdir' hardcode_shlibpath_var=no ;; *-*-sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' - link_rpath_flag='-L$libdir' + hardcode_libdir_flag='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no @@ -594,10 +594,33 @@ else fi echo $ac_t "$ld_shlibs" 1>&6 -if test "$hardcode_shlibpath_var" != no && test "$hardcode_minus_L" = yes; then - echo "$progname: warning: $LD needlessly hardcodes library paths into binaries" 1>&2 - echo "$PACKAGE will compensate by relinking binaries at install time." 1>&2 +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag"; then + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + test "$hardcode_minus_L" != no && + test "$hardcode_shlibpath_var" != no; then + + # Can't link without hardcoding. + hardcode_action=relink + else + hardcode_action=rpath + fi +elif test "$hardcode_direct" = yes || + test "$hardcode_minus_L" = yes || + test "$hardcode_shlibpath_var" = yes; then + + # We can't hardcode non-existant directories, but we can existing ones. + hardcode_action=relink +else + # We can't hardcode anything. + hardcode_action=unsupported fi +echo $ac_t "$hardcode_action" 1>&6 +test "$hardcode_action" = unsupported && can_build_shared=no + reload_flag= reload_cmds='$LD$reload_flag -o $output$reload_objs' @@ -837,9 +860,6 @@ postinstall_cmds='$postinstall_cmds' # Commands used to finish a libtool library installation in a directory. finish_cmds='$finish_cmds' -# The flag that specifies a runtime search path when linking. -link_rpath_flag='$link_rpath_flag' - # How to strip a library file. striplib='$striplib' old_striplib='$old_striplib' @@ -847,6 +867,13 @@ old_striplib='$old_striplib' # This is the shared library path variable. shlibpath_var=$shlibpath_var +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag='$hardcode_libdir_flag' + # 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 bb0ef5172..55870459f 100644 --- a/ltmain.sh.in +++ b/ltmain.sh.in @@ -269,6 +269,8 @@ if test -z "$show_help"; then args="$cc" compile_command="$cc" finalize_command="$cc" + compile_shlibpath= + finalize_shlibpath= deplibs= install_libdir= libobjs= @@ -290,14 +292,24 @@ if test -z "$show_help"; then # suffix= # fi + # We need to know -static, to get the right output filenames. + case " $@ " in + *" -static "*) build_libtool_libs=no ;; + esac + for arg do # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in output) - compile_command="$compile_command $objdir/$arg" - finalize_command="$finalize_command $objdir/$arg"T + 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 args="$args $arg" ;; esac @@ -308,9 +320,8 @@ if test -z "$show_help"; then continue fi - # The finalize and compile arguments. - farg="$arg" - carg="$arg" + args="$args $arg" + prevarg="$arg" case "$arg" in -L*) @@ -330,13 +341,15 @@ if test -z "$show_help"; then -o) prev=output ;; - -rpath) prev=install_libdir carg= farg= ;; + -rpath) + prev=install_libdir + continue + ;; -static) - build_libtool_libs=no link_static="`eval echo \"$link_static_flag\"`" - carg="$link_static" - farg= + compile_command="$compile_command $link_static" + continue ;; -version-file) @@ -345,7 +358,10 @@ if test -z "$show_help"; then exit 1 ;; - -version-info) prev=vinfo carg= farg= ;; + -version-info) + prev=vinfo + continue + ;; -*) cc="$cc $arg" ;; # Some other compiler flag. @@ -361,16 +377,47 @@ if test -z "$show_help"; then *.la) # A libtool-controlled library. + + libdir= + library_names= + old_library= + + # 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 + exit 1 + 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 + exit 1 + fi + + # Get the name of the link library. + linklib= + for linklib in $library_names; do + : + done + + # Find the relevant object directory and library name. + name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'` dir=`echo "$arg" | sed 's%/[^/]*$%%'` - test "$dir" = "$arg" && dir=. - file=`echo "$arg" | sed 's%^.*/%%'` + if test "$dir" = "$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi link_against_libtool_libs="$link_against_libtool_libs $arg" - if test "$build_libtool_libs" = yes; then - # Specify the library as -lNAME. - carg="-l`echo "$file" | sed 's/lib\(..*\)\.la$/\1/'`" - farg="$carg" + if test "$build_libtool_libs" = yes; then if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in @@ -379,50 +426,70 @@ if test -z "$show_help"; then esac fi - # 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 + if test -z "$linklib"; then + echo "$progname: cannot find name of link library for \`$arg'" 1>&2 exit 1 fi - libdir= - . $dir/$file - - if test -z "$libdir"; then - echo "$progname: \`$arg' contains no -rpath information" 1>&2 - exit 1 + if test -n "$hardcode_libdir_flag"; then + tmp=`eval echo \"$hardcode_libdir_flag\"` + compile_command="$compile_command $tmp" + finalize_command="$finalize_command $tmp" fi - if test -n "$link_rpath_flag"; then - carg="`eval echo \"$link_rpath_flag\"` $carg" - farg="$carg" - fi - - if test "$hardcode_minus_L" != yes; then - # Just give the right -L directory flag. - carg="-L$dir/$objdir $carg" + case "$hardcode_action" in + rpath) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = no; then + compile_command="$compile_command -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + compile_shlibpath="$compile_shlibpath$dir:" + compile_command="$compile_command -l$name" + fi + ;; - elif test "$hardcode_shlibpath_var" != no; then - # Give an absolute path to the library. + relink) + # We need an absolute path. case "$dir" in - /*) absdir="$dir" ;; + /*) ;; *) - absdir=`cd $dir && pwd` + absdir=`cd "$dir" && pwd` if test -z "$absdir"; then - echo "$progname: cannot determine absolute pathname of \`$dir'" 1>&2 + echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi - ;; - esac - carg="-L$absdir/$objdir $carg" - farg="-L$libdir $farg" - fi + dir="$absdir" + ;; + esac + + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + compile_command="$compile_command -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + compile_shlibpath="$compile_shlibpath$dir:" + compile_command="$compile_command -l$name" + fi + ;; + esac + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = no; then + finalize_command="$finalize_command -L$libdir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + finalize_shlibpath="$finalize_shlibpath$libdir:" + finalize_command="$finalize_command -l$name" + fi else # Transform directly to old archives if we don't build new libraries. - carg="$dir/$objdir/`echo "$file" | sed 's/\.la$/.a/'`" - farg="$carg" + test -z "$old_library" && old_library="$linklib" + compile_command="$compile_command $dir/$old_library" + finalize_command="$finalize_command $dir/$old_library" fi + continue ;; *) @@ -432,11 +499,8 @@ if test -z "$show_help"; then ;; esac - args="$args $arg" - - compile_command="$compile_command $carg" - finalize_command="$finalize_command $farg" - prevarg="$arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" done if test -n "$prev"; then @@ -725,7 +789,6 @@ if test -z "$show_help"; then if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then # We have no uninstalled library dependencies, so finalize right now. - compile_command=`echo "$compile_command" | sed "s%-o $objdir/%-o %"` $show "$compile_command" $run $compile_command status=$? @@ -734,8 +797,8 @@ if test -z "$show_help"; then if test $status -ne 0 && test -n "$link_static"; then echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2 compile_command=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"` - $show "$compile_command" - $run $compile_command + $show "$finalize_command" + $run $finalize_command status=$? fi exit $status @@ -755,44 +818,36 @@ if test -z "$show_help"; then case "$dir" in /*) # Absolute path. - rpath="$rpath:$dir/$objdir" + rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. - rpath="$rpath:\$thisdir/$dir/$objdir" + rpath="$rpath\$thisdir/$dir:" ;; esac done - - # Strip the ugly leading colon. - rpath=`echo "$rpath" | sed 's/^://'` - - # Prettify the rpath for the link command. - linkrpath=`echo "$rpath" | sed 's%\$thisdir/%%g'` fi # Delete the old output file. $run $rm $output - if test "$hardcode_minus_L" != yes; then - # Things are fine, the world is a beautiful place. - $show "$compile_command" - - elif test "$hardcode_shlibpath_var" = no; then - # We just need to export the shlibpath for the link command. - $show "$shlibpath_var=$linkrpath $compile_command" - eval "$shlibpath_var=$linkrpath" - eval "export $shlibpath_var" + if test -n "$compile_shlibpath"; then + compile_command="$shlibpath_var=$compile_shlibpath\$$shlibpath_var $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=$finalize_shlibpath\$$shlibpath_var $finalize_command" + fi - else + case "$hardcode_action" in + relink) # AGH! Flame the AIX and HP-UX people for me, will ya? - echo "$progname: warning: using a buggy hardcoding system linker" 1>&2 + echo "$progname: warning: using a buggy system linker" 1>&2 echo "$progname: relinking will be required before \`$output' can be installed" 1>&2 + ;; + esac - $show "$compile_command" - fi - - $run $compile_command || exit $? + $show "$compile_command" + eval "$run $compile_command" || exit $? # Now create the wrapper script. echo "creating $output" @@ -828,36 +883,42 @@ else absdir=\`cd "\$thisdir" && pwd\` test -n "\$absdir" && thisdir="\$absdir" - program="\$thisdir/$objdir/$output" + progdir="\$thisdir/$objdir" + program="$output" + + if test -f "\$progdir/\$program"; then + # Run the actual program with our arguments. + args= + for arg + do + # Quote arguments (to preserve shell metacharacters). + args="\$args '\$arg'" + done + + # Export the path to the program. + PATH="\$progdir:\$PATH" + export PATH EOF # Export our shlibpath_var if we have one. if test -n "$shlibpath_var" && test -n "$rpath"; then cat >> $output <>$output <> $output <&2 + echo "\$0: error: \$progdir/\$program does not exist" 1>&2 echo "This script is just a wrapper for \$program." 1>&2 echo "See the $PACKAGE documentation for more information." 1>&2 exit 1 @@ -1168,7 +1229,7 @@ EOF fi done - if test "$hardcode_minus_L" = yes && test "$hardcode_shlibpath_var" != no; then + if test "$hardcode_direct" != no && test "$hardcode_minus_L" != no && test "$hardcode_shlibpath_var" != no; then if test "$finalize" = no; then echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 else diff --git a/tests/ChangeLog b/tests/ChangeLog index 3326cc49b..393ffb38c 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +Thu Jan 16 21:43:18 1997 Gordon Matzigkeit + + * tlibtool: Rewrote to grab all the settings from the generated + libtool script. + + * hardcode.test: Make allowances if shlibpath_var cannot be used + to find libraries at link time, such as on AIX. + Tue Jan 14 09:17:27 1997 Gordon Matzigkeit * demo-conf.test, demo-inst.test, demo-make.test, demo-unst.test, diff --git a/tests/Makefile.am b/tests/Makefile.am index 71a5f7e65..99a42fb53 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -10,5 +10,8 @@ EXTRA_DIST = defs tlibtool $(TESTS) # We need to remove any files that the above tests created. distclean-local: - test -f ../demo/Makefile && cd ../demo && $(MAKE) distclean + -test -f ../demo/Makefile && cd ../demo && $(MAKE) distclean rm -rf =inst + +clean-local: + -test -f ../demo/Makefile && cd ../demo && $(MAKE) clean diff --git a/tests/hardcode.test b/tests/hardcode.test index b50309ac7..1eeb99074 100755 --- a/tests/hardcode.test +++ b/tests/hardcode.test @@ -61,13 +61,20 @@ for file in hc-*; do ;; esac - if grep '.libs' $file > /dev/null; then + if fgrep '.libs' $file > /dev/null; then 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 = yes; 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 if test $expected = yes; then echo ".libs was not hardcoded in \`$file', which fooled libtool" 1>&2