From: Thomas Tanner Date: Sat, 13 Feb 1999 00:10:37 +0000 (+0000) Subject: * syncronized with HEAD X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1dd35bb1a8a5ac7fb478717a8f055f9e9c7bb55;p=thirdparty%2Flibtool.git * syncronized with HEAD * depdemo/Makefile.am: merged rest of my ILD patch * ltmain.in: export shlibpath before linking libraries, create the .lai file in link mode --- diff --git a/ChangeLog b/ChangeLog index 3698fe429..d15229bda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-02-13 Thomas Tanner + + * syncronized with HEAD + * depdemo/Makefile.am: merged rest of my ILD patch + * ltmain.in: export shlibpath before linking libraries, + create the .lai file in link mode + 1999-02-12 Gary V. Vaughan * ltmain.in (deplib): The cygwin environment doesn't actually have diff --git a/Makefile.am b/Makefile.am index f52775936..1479f98e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,7 +58,7 @@ update-timestamps: # Do line number substitution, as well as PACKAGE, VERSION and TIMESTAMP. # Line numbering transliterated from a section in autoconf (Autoconf 2.12). -$(srcdir)/ltconfig: $(srcdir)/ltconfig.in $(top_srcdir)/configure.in $(TSDEPS) +@srcdir@/ltconfig: $(srcdir)/ltconfig.in $(top_srcdir)/configure.in $(TSDEPS) rm -f ltconfig.T date=`$(SHELL) $(srcdir)/mkstamp < $(srcdir)/ChangeLog` && \ $(AWK) '/@LINENO@/ { printf "%d:", NR } { print }' $(srcdir)/ltconfig.in | \ @@ -70,7 +70,7 @@ $(srcdir)/ltconfig: $(srcdir)/ltconfig.in $(top_srcdir)/configure.in $(TSDEPS) mv -f ltconfig.T $@ || \ (rm -f $@ && cp ltconfig.T $@ && rm -f ltconfig.T) -$(srcdir)/ltmain.sh: $(srcdir)/ltmain.in $(top_srcdir)/configure.in $(TSDEPS) +@srcdir@/ltmain.sh: $(srcdir)/ltmain.in $(top_srcdir)/configure.in $(TSDEPS) rm -f ltmain.shT date=`$(SHELL) $(srcdir)/mkstamp < $(srcdir)/ChangeLog` && \ sed -e 's/@''PACKAGE@/@PACKAGE@/' -e 's/@''VERSION@/@VERSION@/' \ @@ -96,12 +96,14 @@ configure-subdirs distdir: $(DIST_MAKEFILE_LIST) # Create and install libltdl.tar.gz install-data-hook: libltdl/Makefile - if (cd libltdl && $(MAKE) distdir distdir=libltdl && \ + @echo 'cd libltdl && $(MAKE) distdir distdir=libltdl && tar -cf libltdl.tar libltdl && gzip $(GZIP_ENV) libltdl.tar' + @if (cd libltdl && $(MAKE) distdir distdir=libltdl && \ tar -cf libltdl.tar libltdl && \ gzip $(GZIP_ENV) libltdl.tar); then \ + echo "$(INSTALL_DATA) libltdl/libltdl.tar.gz $(pkgdatadir)/libltdl.tar.gz"; \ $(INSTALL_DATA) libltdl/libltdl.tar.gz $(pkgdatadir)/libltdl.tar.gz; \ else \ - echo Warning: without gzip, libtool cannot install libltdl.tar.gz; \ + echo "Warning: without gzip, libtool cannot install libltdl.tar.gz"; \ fi; \ rm -rf libltdl/libltdl libltdl/libltdl.tar libltdl/libltdl.tar.gz diff --git a/NEWS b/NEWS index 217bdef84..ccd1fb64b 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,7 @@ NEWS - list of user-visible changes between releases of GNU Libtool New in 1.2e: CVS version: * Support -R for specifying run-time path of programs and library dependencies * Support for BeOS -* Improved support for Win32, aix3, aix4, SysV 4.3, BSD/OS 4.x and NetBSD +* Improved support for aix3, aix4, SysV 4.3, BSD/OS 4.x and NetBSD * New -avoid-version option to avoid versioning for libraries * Various bugfixes diff --git a/THANKS b/THANKS index 948c59cab..99fe19a76 100644 --- a/THANKS +++ b/THANKS @@ -2,7 +2,9 @@ Libtool would not be what it is today without the invaluable help of these people: Everybody who was kind enough to spend time testing libtool, use it in -their packages and report bugs. +their packages and report bugs, who are too numerous to mention here. +Many people who have kindly submitted bug reports and small patches +are credited for their contributions in the ChangeLogs. The following people made especially gracious contributions of their time and energy in helping to track down bugs, port to new systems, @@ -10,39 +12,24 @@ and generally assist in the libtool maintainership process: Akim Demaille Andrey Slepuhin -Axel Thimm Bruno Haible Carl D. Roth -Charles S. Kerr -Chris Laas Chris P. Ross Edouard G. Parmelan Eric Estievenart Erez Zadok H.J. Lu Ian Lance Taylor -Joel Cannon -Joel Klecker Joel N. Weber II Joseph Beckenbach III -Karl Berry Kenneth Albanowski Kurt D. Zeilenga Manfred Weichel Marc J. Fraioli -Mark Elbrecht Mark Kettenis -Mimi Burbank -Oliver Guntermann -Raffaele Sena -Rainer Orth -Ron O'Hara Sebastian Wilhelmi Stephan Kulow Steven M. Schultz -Thomas Esser Todd Vierling Tom Tromey Ulrich Drepper -Vladimir Kushnir -Volker Kuhlmann diff --git a/autogen b/autogen index a33b4c27f..aebb562c7 100644 --- a/autogen +++ b/autogen @@ -19,6 +19,7 @@ for sub in demo depdemo libltdl mdemo cdemo; do rm -f acinclude.m4 cp ../libtool.m4 acinclude.m4 aclocal + autoheader automake --gnits --add-missing autoconf cd .. diff --git a/commit b/commit index 5d3a1e348..591aa1039 100755 --- a/commit +++ b/commit @@ -1,6 +1,6 @@ #! /bin/sh -# commit version 0.9.1 +# commit version 0.9.2 # Copyright (C) 1999, Free Software Foundation @@ -171,7 +171,7 @@ $repeat && break $update && \ if echo "$name: checking for conflicts..." >&2 - (cvs $cvsopt -n update $updateopt ${1+"$@"} 2>/dev/null\ + (cvs $cvsopt -q -n update $updateopt ${1+"$@"} 2>/dev/null \ | while read line; do echo "$line" echo "$line" >&3 @@ -187,10 +187,10 @@ if test ! -f "$log_file"; then case "$line" in "--- ChangeLog"*) :;; "-"*) - echo "$name: the following line in ChangeLog diff is suspicious:" >&2 + echo "$name: *** Warning: the following line in ChangeLog diff is suspicious:" >&2 echo "$line" | sed 's/^.//' >&2;; "+ "*) - echo "$name: lines should start with tabs, not spaces; ignoring line:" >&2 + echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2 echo "$line" | sed 's/^.//' >&2;; "+") echo;; "+ "*) echo "$line";; @@ -208,8 +208,8 @@ if grep '[^ ]' < "$log_file" > /dev/null; then :; else fi if grep '^$' < "$log_file" > /dev/null; then - echo "$name: blank lines should not appear within a commit messages" >&2 - echo "$name: they should be used to separate distinct commits" >&2 + echo "$name: *** Warning: blank lines should not appear within a commit messages." >&2 + echo "$name: *** They should be used to separate distinct commits." >&2 fi ${PAGER-more} "$log_file" || break diff --git a/demo/Makefile.am b/demo/Makefile.am index 7a9b33b7b..ac93cb6d9 100644 --- a/demo/Makefile.am +++ b/demo/Makefile.am @@ -20,16 +20,16 @@ else BUILD_helldl = endif -bin_PROGRAMS = hell hell.debug $(BUILD_helldl) +bin_PROGRAMS = hell hell.static $(BUILD_helldl) # Build hell from main.c and libhello.la hell_SOURCES = main.c -hell_LDADD = -lhello +hell_LDADD = libhello.la -# Create an easier-to-debug version of hell. -hell_debug_SOURCES = main.c -hell_debug_LDADD = -lhello -hell_debug_LDFLAGS = $(STATIC) +# Create a statically linked version of hell. +hell_static_SOURCES = main.c +hell_static_LDADD = libhello.la +hell_static_LDFLAGS = $(STATIC) if BINARY_HELLDL diff --git a/depdemo/Makefile.am b/depdemo/Makefile.am index 5dc42f1c1..9b5a81eeb 100644 --- a/depdemo/Makefile.am +++ b/depdemo/Makefile.am @@ -11,7 +11,7 @@ libl3_la_LIBADD = libl1.la libl2.la libl4_la_SOURCES = l4.c l4.h sysdep.h libl4_la_LIBADD = libl3.la $(LIBADD_M) -bin_PROGRAMS = depdemo.static depdemo +bin_PROGRAMS = depdemo depdemo.static depdemo_SOURCES = main.c depdemo_LDADD = libl1.la libl2.la libl4.la @@ -20,5 +20,4 @@ depdemo_DEPENDENCIES = libl1.la libl2.la libl4.la depdemo_static_SOURCES = $(depdemo_SOURCES) depdemo_static_LDADD = $(depdemo_LDADD) depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES) -depdemo_static_LDFLAGS = -static - +depdemo_static_LDFLAGS = $(STATIC) diff --git a/doc/PLATFORMS b/doc/PLATFORMS index 54ee40d04..a80abfe64 100644 --- a/doc/PLATFORMS +++ b/doc/PLATFORMS @@ -46,7 +46,6 @@ i586-pc-linux-gnulibc1 gcc 1.2e ok i686-pc-linux-gnu gcc 1.2e ok i686-pc-linux-gnu egcs 1.2e ok egcs 1.1.1 i686-pc-linux-gnulibc1 gcc 1.2e ok -i686-pc-cygwin32 egcs 1.2e ok m68k-next-nextstep3 gcc 1.2e ok static m68k-sun-sunos4.1.1 gcc 1.2e NS m88k-dg-dguxR4.12TMU01** gcc 1.2 ok diff --git a/doc/libtool.texi b/doc/libtool.texi index 0d16e818a..2e3c630cf 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -2291,7 +2291,7 @@ in order to guarantee that all the required libraries are found. This restriction is only necessary to preserve compatibility with static library systems and simple dynamic library systems. -Some platforms, such as AIX and Windows 95, do not even allow you this +Some platforms, such as AIX, do not even allow you this flexibility. In order to build a shared library, it must be entirely self-contained (that is, have references only to symbols that are found in the @samp{.lo} files or the specified @samp{-l} libraries), and you @@ -2612,7 +2612,8 @@ Return 0 on success, otherwise the number of errors. @deftypefun lt_dlhandle lt_dlopen (const char *@var{filename}) Open the module with the file name @var{filename} and return a handle for it. @code{lt_dlopen} is able to open libtool dynamic -modules, preloaded static modules and native dynamic libraries. +modules, preloaded static modules, the program itself and +native dynamic libraries. Unresolved symbols in the module are resolved using its dependency libraries and previously dlopened modules. If the executable using this @@ -2621,6 +2622,10 @@ symbols in the executable will also be used to resolve references in the module. Libltdl tries to resolve the symbols immediately and returns @code{NULL} if that fails. +If @var{filename} is NULL @code{lt_dlopen} will return a handle +for the program itself, which can be used to access its symbols +if it was linked with @code{-export-dynamic}. + If libltdl cannot find the library and the file name @var{filename} does not have a directory component it will additionally search in the following search paths for the module (in the order as follows): @@ -2903,7 +2908,7 @@ uninstalled correctly. The @file{mdemo} subdirectory contains a demonstration of a package that uses libtool and the system independent dlopen wrapper @file{libltdl} to load modules. The library @file{libltdl} provides an experimental -dlopen wrapper for various platforms (Linux, Solaris, HP/UX, Win32 etc.) +dlopen wrapper for various platforms (Linux, Solaris, HP/UX etc.) including support for dlpreopened modules (@pxref{Dlpreopening}). The tests @file{mdemo-make.test}, @file{mdemo-exec.test}, diff --git a/libltdl/.cvsignore b/libltdl/.cvsignore index d8e5c8eb3..d2377fd9c 100644 --- a/libltdl/.cvsignore +++ b/libltdl/.cvsignore @@ -9,3 +9,4 @@ conftest* libtool *.lo *.la +stamp-h* diff --git a/libltdl/Makefile.am b/libltdl/Makefile.am index e0ebbf5b4..472ab0510 100644 --- a/libltdl/Makefile.am +++ b/libltdl/Makefile.am @@ -5,25 +5,26 @@ AUTOMAKE_OPTIONS = no-dependencies foreign LTDL_VERSION = -version-info 1:1:1 if INSTALL_LTDL -LTDL_FLAGS = $(LTDL_VERSION) -rpath $(libdir) include_HEADERS = ltdl.h else -LTDL_FLAGS = noinst_HEADERS = ltdl.h endif -EXTRA_LTLIBRARIES = libltdl.la libltdlc.la - -lib_LTLIBRARIES = @LIBLIBS@ -noinst_LTLIBRARIES = @NOINSTLIBS@ +noinst_LTLIBRARIES = libltdl.la libltdl_la_SOURCES = ltdl.c -libltdl_la_LDFLAGS = $(LTDL_FLAGS) libltdl_la_LIBADD = $(LIBADD_DL) -libltdlc_la_SOURCES = $(libltdl_la_SOURCES) -libltdlc_la_LDFLAGS = -libltdlc_la_LIBADD = $(libltdl_la_LIBADD) +lib_LTLIBRARIES = @LIBLIBS@ +EXTRA_LTLIBRARIES = + +@TOINST@/libltdl.la: $(libltdl_la_OBJECTS) $(libltdl_la_DEPENDENCIES) + @test -d $(TOINST) || mkdir $(TOINST) + $(LINK) -o $@ $(libltdl_la_OBJECTS) \ + -rpath $(libdir) $(LTDL_VERSION) $(libltdl_la_LIBADD) + +distclean-local: + test -z $(TOINST) || rm -rf $(TOINST) libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck diff --git a/libltdl/configure.in b/libltdl/configure.in index 0c9e55e78..39aa20517 100644 --- a/libltdl/configure.in +++ b/libltdl/configure.in @@ -2,21 +2,22 @@ dnl Process this file with autoconf to create configure. dnl Initialize the libltdl package. AC_INIT(ltdl.c) AM_INIT_AUTOMAKE(libltdl,1.0,-) +AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE +TOINST=toinst +AC_SUBST(TOINST) + AC_ARG_ENABLE(ltdl-install, [--enable-ltdl-install install libltdl]) AM_CONDITIONAL(INSTALL_LTDL, test x$enable_ltdl_install = xyes) if test x$enable_ltdl_install = xyes; then - LIBLIBS=libltdl.la - NOINSTLIBS= + LIBLIBS=$TOINST/libltdl.la else LIBLIBS= - NOINSTLIBS=libltdl.la fi AC_SUBST(LIBLIBS) -AC_SUBST(NOINSTLIBS) AC_PROG_CC AC_C_CONST @@ -84,11 +85,19 @@ AC_CHECK_FUNCS(strdup strchr strrchr index rindex) AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], libltdl_cv_preloaded_symbols, [dnl - if grep '^global_symbol_pipe=..*$' ./libtool >/dev/null; then - libltdl_cv_preloaded_symbols=yes - else - libltdl_cv_preloaded_symbols=no - fi + ( + rm -f conftest + ./libtool --config > conftest + . ./conftest + rm -f conftest + if test -n "$global_symbol_pipe"; then + echo yes > conftest + else + echo no > conftest + fi + ) + libltdl_cv_preloaded_symbols=`cat conftest` + rm -f conftest ]) if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then AC_DEFINE(HAVE_PRELOADED_SYMBOLS) @@ -112,7 +121,7 @@ if test "$test_dlerror" = yes; then LIBS="$LIBS_SAVE" fi -AM_SYS_SYMBOL_UNDERSCORE +AC_SYS_SYMBOL_UNDERSCORE if test x"$USE_SYMBOL_UNDERSCORE" = xyes; then if test x"$ac_cv_func_dlopen" = xyes || test x"$ac_cv_lib_dl_dlopen" = xyes ; then diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 235bf8738..714eb1ab0 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -20,6 +20,10 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define _LTDL_COMPILE_ +#if HAVE_CONFIG_H +#include +#endif + #if HAVE_STRING_H #include #endif @@ -75,18 +79,18 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. /* This accounts for the _LTX_ separator */ #define LTDL_SYMBOL_OVERHEAD 5 -static const char *objdir = LTDL_OBJDIR; -static const char *shlib_ext = LTDL_SHLIB_EXT; +static const char objdir[] = LTDL_OBJDIR; +static const char shlib_ext[] = LTDL_SHLIB_EXT; -static const char *unknown_error = "unknown error"; -static const char *dlopen_not_supported_error = "dlopen support not available"; -static const char *file_not_found_error = "file not found"; -static const char *no_symbols_error = "no symbols defined"; -static const char *symbol_error = "symbol not found"; -static const char *memory_error = "not enough memory"; -static const char *invalid_handle_error = "invalid handle"; -static const char *buffer_overflow_error = "internal buffer overflow"; -static const char *shutdown_error = "library already shutdown"; +static const char unknown_error[] = "unknown error"; +static const char dlopen_not_supported_error[] = "dlopen support not available"; +static const char file_not_found_error[] = "file not found"; +static const char no_symbols_error[] = "no symbols defined"; +static const char symbol_error[] = "symbol not found"; +static const char memory_error[] = "not enough memory"; +static const char invalid_handle_error[] = "invalid handle"; +static const char buffer_overflow_error[] = "internal buffer overflow"; +static const char shutdown_error[] = "library already shutdown"; #ifndef HAVE_PRELOADED_SYMBOLS /* If libtool won't define it, we'd better do */ @@ -114,7 +118,7 @@ typedef struct lt_dlhandle_t { char *name; /* module name */ int usage; /* usage */ int depcount; /* number of dependencies */ - lt_dlhandle *deps; /* dependencies */ + lt_dlhandle *deplibs; /* dependencies */ lt_ptr_t handle; /* system handle */ lt_ptr_t system; /* system specific data */ } lt_dlhandle_t; @@ -124,7 +128,7 @@ typedef struct lt_dlhandle_t { #undef strdup #define strdup xstrdup -static char * +static inline char * strdup(str) const char *str; { @@ -132,7 +136,7 @@ strdup(str) if (!str) return str; - tmp = malloc(strlen(str)+1); + tmp = (char*) malloc(strlen(str)+1); if (tmp) strcpy(tmp, str); return tmp; @@ -150,7 +154,7 @@ strdup(str) # define strchr xstrchr -static const char* +static inline const char* strchr(str, ch) const char *str; int ch; @@ -177,7 +181,7 @@ strchr(str, ch) # define strrchr xstrrchr -static const char* +static inline const char* strrchr(str, ch) const char *str; int ch; @@ -608,14 +612,19 @@ presym_open (handle, filename) { lt_dlsymlists_t *lists = preloaded_symbols; - if (!filename) { - last_error = file_not_found_error; - return 1; - } if (!lists) { last_error = no_symbols_error; return 1; } + if (!filename) { + if (!default_preloaded_symbols) { + last_error = file_not_found_error; + return 1; + } else { + handle->handle = (lt_ptr_t) default_preloaded_symbols; + return 0; + } + } while (lists) { const lt_dlsymlist *syms = lists->syms; @@ -765,28 +774,37 @@ tryall_dlopen (handle, filename) /* check whether the module was already opened */ cur = handles; - while (cur && strcmp(cur->filename, filename)) + while (cur) { + if (!cur->filename && !filename) + break; + if (cur->filename && filename && + strcmp(cur->filename, filename) == 0) + break; cur = cur->next; + } if (cur) { cur->usage++; - free(*handle); *handle = cur; return 0; } cur = *handle; - cur->filename = strdup(filename); - if (!cur->filename) { - last_error = memory_error; - return 1; - } + if (filename) { + cur->filename = strdup(filename); + if (!cur->filename) { + last_error = memory_error; + return 1; + } + } else + cur->filename = 0; while (type) { if (type->lib_open(cur, filename) == 0) break; type = type->next; } if (!type) { - free(cur->filename); + if (cur->filename) + free(cur->filename); return 1; } cur->type = type; @@ -803,8 +821,6 @@ find_module (handle, dir, libdir, dlname, old_name, installed) const char *old_name; int installed; { - char filename[LTDL_FILENAME_MAX]; - /* try to open the old library first; if it was dlpreopened, we want the preopened version of it, even if a dlopenable module is available */ @@ -813,29 +829,61 @@ find_module (handle, dir, libdir, dlname, old_name, installed) /* try to open the dynamic library */ if (dlname) { /* try to open the installed module */ - if (installed && - strlen(libdir)+1+strlen(dlname) < LTDL_FILENAME_MAX) { + if (installed && libdir) { + int ret; + char *filename = (char*) + malloc(strlen(libdir)+1+strlen(dlname)+1); + + if (!filename) { + last_error = memory_error; + return 1; + } strcpy(filename, libdir); strcat(filename, "/"); strcat(filename, dlname); - if (tryall_dlopen(handle, filename) == 0) + ret = tryall_dlopen(handle, filename) == 0; + free(filename); + if (ret) return 0; } /* try to open the not-installed module */ - if (!installed && - strlen(dir)+strlen(objdir)+strlen(dlname) - < LTDL_FILENAME_MAX) { - strcpy(filename, dir); + if (!installed) { + int ret; + char *filename = (char*) + malloc((dir ? strlen(dir) : 0) + + strlen(objdir) + strlen(dlname) + 1); + + if (!filename) { + last_error = memory_error; + return 1; + } + if (dir) + strcpy(filename, dir); + else + *filename = 0; strcat(filename, objdir); strcat(filename, dlname); - if (tryall_dlopen(handle, filename) == 0) + + ret = tryall_dlopen(handle, filename) == 0; + free(filename); + if (ret) return 0; } - /* hmm, maybe it was moved to another directory */ - if (strlen(dir)+strlen(dlname) < LTDL_FILENAME_MAX) { - strcpy(filename, dir); + /* hmm, maybe it was moved to another directory. + Should we really support this? */ + { + int ret; + char *filename = (char*) + malloc((dir ? strlen(dir) : 0) + + strlen(dlname) + 1); + if (dir) + strcpy(filename, dir); + else + *filename = 0; strcat(filename, dlname); - if (tryall_dlopen(handle, filename) == 0) + ret = tryall_dlopen(handle, filename) == 0; + free(filename); + if (ret) return 0; } } @@ -847,62 +895,74 @@ static lt_ptr_t find_file (basename, search_path, pdir, handle) const char *basename; const char *search_path; - char *pdir; + char **pdir; lt_dlhandle *handle; { /* when handle != NULL search a library, otherwise a file */ /* return NULL on failure, otherwise the file/handle */ - char filename[LTDL_FILENAME_MAX]; - const char *cur, *next; - FILE *file; - int lendir; + char *filename = 0; + int filenamesize = 0; + const char *next = search_path; + int lenbase = strlen(basename); - if (!search_path || !strlen(search_path)) { + if (!next || !*next) { last_error = file_not_found_error; return 0; } - cur = search_path; - while (cur) { + while (next) { + int lendir; + const char *cur = next; + next = strchr(cur, ':'); - if (next) { - if (next - cur + 1 >= LTDL_FILENAME_MAX) { - last_error = buffer_overflow_error; - return 0; - } - strncpy(filename, cur, next - cur); - filename[next - cur] = '\0'; - cur = next+1; - } else { - if (strlen(cur)+1 >= LTDL_FILENAME_MAX) { - last_error = buffer_overflow_error; + if (!next) + next = cur + strlen(cur); + lendir = next - cur; + if (*next == ':') + ++next; + else + next = 0; + if (lendir == 0) + continue; + if (lendir + 1 + lenbase >= filenamesize) { + if (filename) + free(filename); + filenamesize = lendir + 1 + lenbase + 1; + filename = (char*) malloc(filenamesize); + if (!filename) { + last_error = memory_error; return 0; } - strcpy(filename, cur); - cur = 0; } - if (!*filename) - continue; - lendir = strlen(filename); - if (filename[lendir-1] != '/') { - strcat(filename, "/"); - lendir++; - } - if (lendir+strlen(basename) < LTDL_FILENAME_MAX) { - strcat(filename, basename); - if (handle) { - if (tryall_dlopen(handle, filename) == 0) - return (lt_ptr_t) handle; - } else { - file = fopen(filename, LTDL_READTEXT_MODE); - if (file) { - filename[lendir] = '\0'; - strcpy(pdir, filename); - return (lt_ptr_t) file; - } + strncpy(filename, cur, lendir); + if (filename[lendir-1] != '/') + filename[lendir++] = '/'; + strcpy(filename+lendir, basename); + if (handle) { + if (tryall_dlopen(handle, filename) == 0) { + free(filename); + return (lt_ptr_t) handle; + } + } else { + FILE *file = fopen(filename, LTDL_READTEXT_MODE); + if (file) { + if (*pdir) + free(*pdir); + filename[lendir] = '\0'; + *pdir = strdup(filename); + if (!*pdir) { + /* We could have even avoided the + strdup, but there would be some + memory overhead. */ + *pdir = filename; + } else + free(filename); + return (lt_ptr_t) file; } } } + if (filename) + free(filename); last_error = file_not_found_error; return 0; } @@ -914,7 +974,7 @@ load_deplibs(handle, deplibs) { /* FIXME: load deplibs */ handle->depcount = 0; - handle->deps = 0; + handle->deplibs = 0; return 0; } @@ -926,7 +986,7 @@ unload_deplibs(handle) return 0; } -static int +static inline int trim (dest, s) char **dest; const char *s; @@ -938,7 +998,7 @@ trim (dest, s) if (*dest) free(*dest); if (len > 3 && s[0] == '\'') { - tmp = malloc(i - s); + tmp = (char*) malloc(i - s); if (!tmp) { last_error = memory_error; return 1; @@ -951,13 +1011,19 @@ trim (dest, s) return 0; } -static int -free_vars(dlname, oldname, libdir, deplibs) +static inline int +free_vars(dir, name, dlname, oldname, libdir, deplibs) + char *dir; + char *name; char *dlname; char *oldname; char *libdir; char *deplibs; { + if (dir) + free(dir); + if (name) + free(name); if (dlname) free(dlname); if (oldname) @@ -969,37 +1035,47 @@ free_vars(dlname, oldname, libdir, deplibs) return 0; } - lt_dlhandle lt_dlopen (filename) const char *filename; { - lt_dlhandle handle; - char dir[LTDL_FILENAME_MAX]; + lt_dlhandle handle, newhandle; const char *basename, *ext; const char *saved_error = last_error; - char *name = 0; + char *dir = 0, *name = 0; if (!filename) { - last_error = file_not_found_error; - return 0; + handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t)); + if (!handle) { + last_error = memory_error; + return 0; + } + handle->usage = 0; + newhandle = handle; + if (tryall_dlopen(handle, 0) != 0) { + free(newhandle); + return 0; + } + if (newhandle != handle) + free(newhandle); + return handle; } basename = strrchr(filename, '/'); - if (basename) + if (basename) { basename++; - else + dir = (char*) malloc(basename - filename + 1); + if (!dir) { + last_error = memory_error; + return 0; + } + strncpy(dir, filename, basename - filename); + dir[basename - filename] = '\0'; + } else basename = filename; - if (basename - filename >= LTDL_FILENAME_MAX) { - last_error = buffer_overflow_error; - return 0; - } - strncpy(dir, filename, basename - filename); - dir[basename - filename] = '\0'; /* check whether we open a libtool module (.la extension) */ ext = strrchr(basename, '.'); if (ext && strcmp(ext, ".la") == 0) { /* this seems to be a libtool module */ - char tmp[LTDL_FILENAME_MAX]; FILE *file; int i; char *dlname = 0, *old_name = 0; @@ -1011,68 +1087,71 @@ lt_dlopen (filename) int installed = 1; /* extract the module name from the file name */ - if (strlen(basename) >= sizeof(tmp)) { - last_error = buffer_overflow_error; + name = (char*) malloc(ext - basename + 1); + if (!name) { + last_error = memory_error; + if (dir) + free(dir); return 0; } /* canonicalize the module name */ for (i = 0; i < ext - basename; i++) if (isalnum(basename[i])) - tmp[i] = basename[i]; + name[i] = basename[i]; else - tmp[i] = '_'; - tmp[ext - basename] = '\0'; - name = strdup(tmp); - if (!name) { - last_error = memory_error; - return 0; - } + name[i] = '_'; + name[ext - basename] = '\0'; /* now try to open the .la file */ file = fopen(filename, LTDL_READTEXT_MODE); if (!file) last_error = file_not_found_error; - if (!file && !*dir) { + if (!file && !dir) { /* try other directories */ file = (FILE*) find_file(basename, user_search_path, - dir, 0); + &dir, 0); if (!file) file = (FILE*) find_file(basename, getenv("LTDL_LIBRARY_PATH"), - dir, 0); + &dir, 0); #ifdef LTDL_SHLIBPATH_VAR if (!file) file = (FILE*) find_file(basename, getenv(LTDL_SHLIBPATH_VAR), - dir, 0); + &dir, 0); #endif } if (!file) { - free(name); + if (name) + free(name); + if (dir) + free(dir); return 0; } /* read the .la file */ while (!feof(file)) { - if (!fgets(tmp, sizeof(tmp), file)) + char line[LTDL_FILENAME_MAX]; + + if (!fgets(line, sizeof(line), file)) break; - if (tmp[0] == '\n' || tmp[0] == '#') + if (line[0] == '\n' || line[0] == '#') continue; - if (strncmp(tmp, "dlname=", 7) == 0) - error = trim(&dlname, &tmp[7]); + if (strncmp(line, "dlname=", 7) == 0) + error = trim(&dlname, &line[7]); else - if (strncmp(tmp, "old_library=", 12) == 0) - error = trim(&old_name, &tmp[12]); + if (strncmp(line, "old_library=", 12) == 0) + error = trim(&old_name, &line[12]); else - if (strncmp(tmp, "libdir=", 7) == 0) - error = trim(&libdir, &tmp[7]); + if (strncmp(line, "libdir=", 7) == 0) + error = trim(&libdir, &line[7]); else - if (strncmp(tmp, "dl_dependency_libs=", 20) == 0) - error = trim(&deplibs, &tmp[20]); + if (strncmp(line, "dl_dependency_libs=", 20) == 0) + error = trim(&deplibs, &line[20]); else - if (strcmp(tmp, "installed=yes\n") == 0) + if (strcmp(line, "installed=yes\n") == 0) installed = 1; else - if (strcmp(tmp, "installed=no\n") == 0) + if (strcmp(line, "installed=no\n") == 0) installed = 0; if (error) break; @@ -1085,13 +1164,14 @@ lt_dlopen (filename) free(handle); if (!error) last_error = memory_error; - free_vars(dlname, old_name, libdir, deplibs); - free(name); + free_vars(name, dir, dlname, old_name, libdir, deplibs); return 0; } handle->usage = 0; if (load_deplibs(handle, deplibs) == 0) { - if (find_module(&handle, dir, libdir, + newhandle = handle; + /* find_module may replace newhandle */ + if (find_module(&newhandle, dir, libdir, dlname, old_name, installed)) { unload_deplibs(handle); error = 1; @@ -1100,37 +1180,57 @@ lt_dlopen (filename) error = 1; if (error) { free(handle); - free_vars(dlname, old_name, libdir, deplibs); - free(name); + free_vars(name, dir, dlname, old_name, libdir, deplibs); return 0; } + if (handle != newhandle) { + unload_deplibs(handle); + } } else { /* not a libtool module */ handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t)); if (!handle) { last_error = memory_error; + if (dir) + free(dir); return 0; } handle->usage = 0; - if (tryall_dlopen(&handle, filename) && (!*dir - || (find_file(basename, user_search_path, 0, &handle) - && find_file(basename, getenv("LTDL_LIBRARY_PATH"), - 0, &handle) + /* non-libtool modules don't have dependencies */ + handle->depcount = 0; + handle->deplibs = 0; + newhandle = handle; + if (tryall_dlopen(&handle, filename) + && (!dir + || (!find_file(basename, user_search_path, 0, &handle) + && !find_file(basename, + getenv("LTDL_LIBRARY_PATH"), + 0, &handle) #ifdef LTDL_SHLIBPATH_VAR - && find_file(basename, getenv(LTDL_SHLIBPATH_VAR), - 0, &handle) + && !find_file(basename, + getenv(LTDL_SHLIBPATH_VAR), + 0, &handle) #endif - ))) { + ))) { free(handle); + if (dir) + free(dir); return 0; } } + if (newhandle != handle) { + free(handle); + handle = newhandle; + } if (!handle->usage) { handle->usage = 1; handle->name = name; handle->next = handles; handles = handle; - } + } else if (name) + free(name); + if (dir) + free(dir); last_error = saved_error; return handle; } @@ -1140,7 +1240,7 @@ lt_dlopenext (filename) const char *filename; { lt_dlhandle handle; - char tmp[LTDL_FILENAME_MAX]; + char *tmp; int len; const char *saved_error = last_error; @@ -1158,8 +1258,9 @@ lt_dlopenext (filename) if (handle) return handle; /* try "filename.la" */ - if (len+3 >= sizeof(tmp)) { - last_error = buffer_overflow_error; + tmp = (char*) malloc(len+4); + if (!tmp) { + last_error = memory_error; return 0; } strcpy(tmp, filename); @@ -1167,23 +1268,31 @@ lt_dlopenext (filename) handle = lt_dlopen(tmp); if (handle) { last_error = saved_error; + free(tmp); return handle; } #ifdef LTDL_SHLIB_EXT /* try "filename.EXT" */ - tmp[len] = '\0'; - if (len+strlen(shlib_ext) >= sizeof(tmp)) { - last_error = buffer_overflow_error; - return 0; - } + if (strlen(shlib_ext) > 3) { + free(tmp); + tmp = (char*) malloc(len + strlen(shlib_ext) + 1); + if (!tmp) { + last_error = memory_error; + return 0; + } + strcpy(tmp, filename); + } else + tmp[len] = '\0'; strcat(tmp, shlib_ext); handle = lt_dlopen(tmp); if (handle) { last_error = saved_error; + free(tmp); return handle; } #endif last_error = file_not_found_error; + free(tmp); return 0; } @@ -1248,7 +1357,7 @@ lt_dlsym (handle, symbol) if (lensym + LTDL_SYMBOL_OVERHEAD < LTDL_SYMBOL_LENGTH) sym = lsym; else - sym = malloc(lensym + LTDL_SYMBOL_OVERHEAD + 1); + sym = (char*) malloc(lensym + LTDL_SYMBOL_OVERHEAD + 1); if (!sym) { last_error = buffer_overflow_error; return 0; diff --git a/libtool.m4 b/libtool.m4 index 545776ab0..dccffd2d2 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -21,19 +21,19 @@ ## configuration script generated by Autoconf, you may include it under ## the same distribution terms that you use for the rest of that program. -# serial 30 AM_PROG_LIBTOOL -AC_DEFUN(AM_PROG_LIBTOOL, +# serial 31 AC_PROG_LIBTOOL +AC_DEFUN(AC_PROG_LIBTOOL, [AC_PREREQ(2.12.2)dnl -AC_REQUIRE([AM_ENABLE_SHARED])dnl -AC_REQUIRE([AM_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AM_PROG_LD])dnl -AC_REQUIRE([AM_PROG_NM])dnl -AC_REQUIRE([AM_SYS_NM_PARSE])dnl -AC_REQUIRE([AM_SYS_SYMBOL_UNDERSCORE])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_SYS_NM_PARSE])dnl +AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl # Always use our own libtool. @@ -83,7 +83,7 @@ case "$host" in ;; *-*-cygwin32*) - AM_SYS_LIBTOOL_CYGWIN32 + AC_SYS_LIBTOOL_CYGWIN32 ;; esac @@ -116,15 +116,15 @@ LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" exec 5>>./config.log ]) -# AM_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AM_ENABLE_SHARED[(DEFAULT)] +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. -AC_DEFUN(AM_ENABLE_SHARED, -[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_DEFUN(AC_ENABLE_SHARED, +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT], +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in @@ -142,26 +142,26 @@ no) enable_shared=no ;; IFS="$ac_save_ifs" ;; esac], -enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) -# AM_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN(AM_DISABLE_SHARED, -[AM_ENABLE_SHARED(no)]) +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AC_DISABLE_SHARED, +[AC_ENABLE_SHARED(no)]) -# AM_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN(AM_DISABLE_STATIC, -[AM_ENABLE_STATIC(no)]) +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AC_DISABLE_STATIC, +[AC_ENABLE_STATIC(no)]) -# AM_ENABLE_STATIC - implement the --enable-static flag -# Usage: AM_ENABLE_STATIC[(DEFAULT)] +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. -AC_DEFUN(AM_ENABLE_STATIC, -[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_DEFUN(AC_ENABLE_STATIC, +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT], +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in @@ -179,12 +179,12 @@ no) enable_static=no ;; IFS="$ac_save_ifs" ;; esac], -enable_static=AM_ENABLE_STATIC_DEFAULT)dnl +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) -# AM_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN(AM_PROG_LD, +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) @@ -284,10 +284,10 @@ else fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_SUBST(LD) -AM_PROG_LD_GNU +AC_PROG_LD_GNU ]) -AC_DEFUN(AM_PROG_LD_GNU, +AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then @@ -297,8 +297,8 @@ else fi]) ]) -# AM_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN(AM_PROG_NM, +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, [if test -n "$NM"; then @@ -332,11 +332,11 @@ AC_MSG_RESULT([$NM]) AC_SUBST(NM) ]) -# AM_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed +# AC_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed # by C symbol name from nm. -AC_DEFUN(AM_SYS_NM_PARSE, +AC_DEFUN(AC_SYS_NM_PARSE, [AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AM_PROG_NM])dnl +AC_REQUIRE([AC_PROG_NM])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output]) AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe, @@ -345,7 +345,7 @@ AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe, changequote(,)dnl # Character class describing NM global symbol codes. -ac_symcode='[BCDEGRSTU]' +ac_symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)' @@ -356,29 +356,23 @@ ac_symxfrm='\1 \1' # Define system-specific variables. case "$host_os" in aix*) - ac_symcode='[BCDTU]' + ac_symcode='[BCDT]' + ;; +cygwin32* | mingw32*) + ac_symcode='[ABCDGISTW]' ;; irix*) - # Cannot use undefined symbols on IRIX because inlined functions mess us up. ac_symcode='[BCDEGRST]' ;; solaris*) - ac_symcode='[BDTU]' + ac_symcode='[BDT]' ;; esac # If we're using GNU nm, then use its standard symbol codes. if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - ac_symcode='[ABCDGISTUW]' -fi - -case "$host_os" in -cygwin32* | mingw32*) - # We do not want undefined symbols on cygwin32. The user must - # arrange to define them via -l arguments. ac_symcode='[ABCDGISTW]' - ;; -esac +fi changequote([,])dnl # Try without a prefix undercore, then with it. @@ -386,11 +380,12 @@ for ac_symprfx in "" "_"; do # Write the raw and C identifiers. # Unlike in ltconfig.in, we need $ac_symprfx before $ac_symxfrm here, - # otherwise AM_SYS_SYMBOL_UNDERSCORE will always be false - ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_symprfx$ac_sympat$/$ac_symprfx$ac_symxfrm/p'" + # otherwise AC_SYS_SYMBOL_UNDERSCORE will always be false + ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]$ac_symcode[ ][ ]*$ac_symprfx$ac_sympat$/$ac_symprfx$ac_symxfrm/p'" # Check to see that the pipe works correctly. ac_pipe_works=no + rm -f conftest.$ac_ext cat > conftest.$ac_ext < "$ac_nlist"T; then mv -f "$ac_nlist"T "$ac_nlist" - ac_wcout=`wc "$ac_nlist" 2>/dev/null` -changequote(,)dnl - ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` -changequote([,])dnl - (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1 else rm -f "$ac_nlist"T - ac_count=-1 fi # Make sure that we snagged all the symbols we need. @@ -438,18 +428,16 @@ EOF # define lt_ptr_t void * #else # define lt_ptr_t char * +# define const #endif -/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ -int dld_preloaded_symbol_count = $ac_count; - /* The mapping between symbol names and symbols. */ -struct { - char *name; +const struct { + const char *name; lt_ptr_t address; } changequote(,)dnl -dld_preloaded_symbols[] = +lt_preloaded_symbols[] = changequote([,])dnl { EOF @@ -512,17 +500,17 @@ fi AC_MSG_RESULT($ac_result) ]) -# AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32 -AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32, +# AC_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32 +AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN32, [AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) ]) -# AM_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols +# AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols # with an underscore? -AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, -[AC_REQUIRE([AM_PROG_NM])dnl -AC_REQUIRE([AM_SYS_NM_PARSE])dnl +AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE, +[AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_SYS_NM_PARSE])dnl AC_MSG_CHECKING([for _ prefix in compiled symbols]) AC_CACHE_VAL(ac_cv_sys_symbol_underscore, [ac_cv_sys_symbol_underscore=no @@ -557,3 +545,15 @@ AC_MSG_RESULT($ac_cv_sys_symbol_underscore) USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no} AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl ]) + +dnl old names +AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl +AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl +AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl +AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl +AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl +AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl +AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl +AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl +AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl +AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32, [indir([AC_SYS_LIBTOOL_CYGWIN32])])dnl diff --git a/libtoolize.in b/libtoolize.in index 0652c9d37..12dc87d14 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -184,7 +184,7 @@ else fi if test -z "$automake"; then - if egrep '^AM_PROG_LIBTOOL' configure.in >/dev/null 2>&1; then : + if egrep '^A[MC]_PROG_LIBTOOL' configure.in >/dev/null 2>&1; then : else echo "Remember to add \`AM_PROG_LIBTOOL' to \`configure.in'." fi @@ -199,15 +199,15 @@ if test -z "$automake"; then updatemsg="add the contents of \`$libtool_m4' to \`aclocal.m4'" fi - if egrep '^AC_DEFUN\(AM_PROG_LIBTOOL' aclocal.m4 >/dev/null 2>&1; then + if egrep '^AC_DEFUN\(A[MC]_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'` + instserial=`grep '^# serial ' $libtool_m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` if test -z "$instserial"; then echo "$progname: warning: no serial number on \`$libtool_m4'" 1>&2 else # If the local macro has no serial number, we assume it's ancient. - localserial=`grep '^# serial ' aclocal.m4 | grep 'AM_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` + localserial=`grep '^# serial ' aclocal.m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` test -z "$localserial" && localserial=0 diff --git a/ltconfig.in b/ltconfig.in index 0e566f545..fa1525b8b 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -106,7 +106,7 @@ if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} else # Try using printf. - echo='printf %s\n' + echo='printf "%s\n"' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # Cool, printf works @@ -999,11 +999,14 @@ allow_undefined_flag= no_undefined_flag= need_lib_prefix=unknown need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments archive_cmds= archive_sym_cmds= old_archive_from_new_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= +thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no @@ -1041,7 +1044,7 @@ if test "$with_gnu_ld" = yes; then ;; sunos4*) - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs' + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' wlarc= hardcode_direct=yes hardcode_minus_L=yes @@ -1050,7 +1053,7 @@ if test "$with_gnu_ld" = yes; then beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -nostart ${wl}-soname $wl$soname -o $lib $libobjs $deplibs' + archive_cmds='$CC -nostart ${wl}-soname $wl$soname -o $lib $libobjs $deplibs $linkopts' else ld_shlibs=no fi @@ -1067,30 +1070,30 @@ if test "$with_gnu_ld" = yes; then (cd $objdir && $CC -c $soname-ltdll.c)~ echo EXPORTS > $objdir/$soname-def~ $DLLTOOL --export-all --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs~ - $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs' + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' archive_sym_cmds='rm -f $objdir/$soname-ltdll.c~ sed -e "/^# \/\* ltdll.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ (cd $objdir && $CC -c $soname-ltdll.c)~ echo EXPORTS > $objdir/$soname-def~ cat "$export_symbols" >> $objdir/$soname-def~ - $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs' + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' - old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib $libobjs $deplibs' - archive_sym_cmds='$CC -shared ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib $libobjs $deplibs' + archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib $libobjs $deplibs $linkopts' + archive_sym_cmds='$CC -shared ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib $libobjs $deplibs $linkopts' else ld_shlibs=no fi @@ -1109,8 +1112,8 @@ else aix3*) allow_undefined_flag=unsupported archive_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp~ - $LD -o $objdir/$soname $libobjs $deplibs -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' - archive_sym_cmds='$LD -o $objdir/$soname $libobjs $deplibs -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + $LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + archive_sym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$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 @@ -1125,19 +1128,19 @@ else allow_undefined_flag= if test "$with_gcc" = yes; then if strings `${CC} -print-prog-name=collect2` | \ - grep resolve_lib_name >/dev/null + grep resolve_lib_name >/dev/null then - # We have reworked collect2 - hardcode_direct=yes + # We have reworked collect2 + hardcode_direct=yes else - # We have old collect2 - hardcode_direct=unsupported + # We have old collect2 + hardcode_direct=unsupported fi - archive_cmds='$CC -shared ${wl}-bnoentry -o $objdir/$soname $libobjs $deplibs' + archive_cmds='$CC -shared ${wl}-bnoentry -o $objdir/$soname $libobjs $deplibs $linkopts' else archive_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp~ - $CC -o $objdir/$soname $libobjs $deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry' - archive_sym_cmds='$CC -o $objdir/$soname $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bM:SRE ${wl}-bnoentry' + $CC -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry' + archive_sym_cmds='$CC -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bM:SRE ${wl}-bnoentry' hardcode_direct=yes fi hardcode_minus_L=yes @@ -1164,7 +1167,7 @@ else # Tell ltmain to make .lib files, not .a files. libext=lib # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. @@ -1182,7 +1185,7 @@ else # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs /usr/lib/c++rt0.o' + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_minus_L=no # verified on 2.2.6 @@ -1191,7 +1194,7 @@ else # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs' + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no @@ -1199,7 +1202,7 @@ else # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs' + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_minus_L=no @@ -1207,7 +1210,7 @@ else ;; hpux9*) - archive_cmds='$rm $objdir/$soname~$LD -b +s +b $install_libdir -o $objdir/$soname $libobjs $deplibs~test $objdir/$soname = $lib || mv $objdir/$soname $lib' + archive_cmds='$rm $objdir/$soname~$LD -b +s +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_direct=yes hardcode_minus_L=yes @@ -1215,7 +1218,7 @@ else ;; hpux10* | hpux11*) - archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib $libobjs $deplibs' + archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_direct=yes hardcode_minus_L=yes @@ -1224,18 +1227,19 @@ else irix5* | irix6*) if test "$with_gcc" = yes; then - archive_cmds='$CC -shared -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring $libobjs $deplibs' + archive_cmds='$CC -shared -o $lib ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` $libobjs $deplibs $linkopts' else - archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring $libobjs $deplibs' + archive_cmds='$LD -shared -o $lib -soname $soname `test -n "$verstring" && echo -set_version $verstring` $libobjs $deplibs $linkopts' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs' # a.out + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs' # ELF + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF fi hardcode_libdir_flag_spec='${wl}-R$libdir' hardcode_direct=yes @@ -1243,7 +1247,7 @@ else ;; openbsd*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs' + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no @@ -1253,24 +1257,24 @@ else hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $objdir/$libname.def' + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' ;; osf3* | osf4*) if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring $libobjs $deplibs' + archive_cmds='$CC -shared${allow_undefined_flag} -o $lib ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` $libobjs $deplibs $linkopts' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring $libobjs $deplibs' + archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname `test -n "$verstring" && echo -set_version $verstring` $libobjs $deplibs $linkopts' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; sco3.2v5*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs' + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes ;; @@ -1278,9 +1282,9 @@ else no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs' - archive_sym_cmds='$echo "{ global:" > $lib.exp~sed $export_symbols -e "s/.*/\1;/" >> $lib.exp~$echo "local: * }" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $export_symbols -h $soname -o $lib $libobjs $deplibs~$rm $lib.exp' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_sym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no ;; @@ -1289,9 +1293,9 @@ else # Why do we need -Bstatic? To avoid inter-library dependencies, maybe... if test "$with_gcc" = yes; then # Use -fPIC here because libgcc is multilibbed - archive_cmds='$CC -shared ${wl}-Bstatic -fPIC -o $lib $libobjs $deplibs' + archive_cmds='$CC -shared ${wl}-Bstatic -fPIC -o $lib $libobjs $deplibs $linkopts' else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs' + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes @@ -1300,7 +1304,7 @@ else ;; sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs' + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=no @@ -1308,7 +1312,7 @@ else ;; uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs' + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=no hardcode_minus_L=no @@ -1316,7 +1320,7 @@ else ;; dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs' + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=no hardcode_minus_L=no @@ -1402,7 +1406,7 @@ fi for ac_symprfx in "" "_"; do # Write the raw and C identifiers. - global_symbol_pipe="sed -n -e 's/^.* $symcode $ac_symprfx$sympat$/$symxfrm/p'" + global_symbol_pipe="sed -n -e 's/^.*[ ]$symcode[ ][ ]*$ac_symprfx$sympat$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no @@ -1604,7 +1608,7 @@ bsdi4*) soname_spec='${libname}.so' finish_cmds='PATH="$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH - check_shared_deplibs_method='file_magic ELF 32-bit LSB shared object' + deplibs_check_method='file_magic ELF 32-bit LSB shared object' sys_lib_search_path="/shlib /usr/lib /usr/local/lib" ;; @@ -1656,6 +1660,8 @@ hpux9* | hpux10* | hpux11*) # link against other versions. dynamic_linker="$host_os dld.sl" version_type=sunos + need_lib_prefix=no + need_version=no shlibpath_var=SHLIB_PATH library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' soname_spec='${libname}${release}.sl$major' @@ -1666,15 +1672,28 @@ hpux9* | hpux10* | hpux11*) irix5*) version_type=osf soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' shlibpath_var=LD_LIBRARY_PATH + deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" # or should it be pass_all? + file_magic_command=file ;; irix6*) version_type=osf + need_lib_prefix=no + need_version=no soname_spec='${libname}${release}.so' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - shlibpath_var=LD_LIBRARYN32_PATH + case "$LD" in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" # or should it be pass_all? + file_magic_command=file ;; # No shared lib support for Linux oldld, aout, or coff. @@ -1721,6 +1740,10 @@ netbsd*) openbsd*) version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi library_names_spec='${libname}${release}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -1767,6 +1790,9 @@ sunos4*) library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi need_version=yes ;; @@ -1784,13 +1810,15 @@ sysv4.2uw2* | sysv4.3* | sysv5*) uts4*) version_type=linux - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; dgux*) version_type=linux + need_lib_prefix=no + need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH @@ -1852,20 +1880,23 @@ if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then fi LTSHELL="$SHELL" +LTCONFIG_VERSION="$VERSION" + # Only quote variables if we're using ltmain.sh. case "$ltmain" in *.sh) # Now quote all the things that may contain metacharacters. for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ - old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM LTSHELL VERSION \ + old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ reload_flag reload_cmds wl \ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - whole_archive_flag_spec libname_spec library_names_spec soname_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ old_postuninstall_cmds archive_cmds archive_sym_cmds postinstall_cmds postuninstall_cmds \ file_magic_command deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe \ - hardcode_libdir_flag_spec hardcode_libdir_separator sys_lib_search_path_spec \ + finish_cmds finish_eval global_symbol_pipe hardcode_libdir_flag_spec \ + hardcode_libdir_separator sys_lib_search_path_spec \ compiler_c_o compiler_o_lo need_locks; do case "$var" in @@ -1965,7 +1996,7 @@ cat <> "$cfgfile" # debugging $progname, is in ./config.log if it exists. # The version of $progname that generated this script. -LTCONFIG_VERSION="$VERSION" +LTCONFIG_VERSION=$LTCONFIG_VERSION # Shell to use when invoking shell scripts. SHELL=$LTSHELL @@ -2050,6 +2081,9 @@ export_dynamic_flag_spec=$export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$whole_archive_flag_spec +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$thread_safe_flag_spec + # Library versioning type. version_type=$version_type diff --git a/ltmain.in b/ltmain.in index d062920e1..b3e1292f5 100644 --- a/ltmain.in +++ b/ltmain.in @@ -1501,8 +1501,6 @@ compiler." fi name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - # FIXME: libraries without lib prefix require direct hardcoding - # i.e. for need_lib_prefix=no we require hardcode_direct=yes if test -z "$libdir"; then # It is a libtool convenience library. @@ -1688,8 +1686,6 @@ compiler." deplibs=`$echo "X$deplibs" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` fi - # FIXME: shlibpath must be set in archive_cmds - # Restore the variables link_dir=$link_dir_save link_command=$link_command_save @@ -1971,6 +1967,9 @@ EOF eval cmds=\"$archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + if test -n "$shlibpath"; then + eval "export $shlibpath_var='$shlibpath\$$shlibpath_var'" + fi for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2687,8 +2686,8 @@ static const void *lt_preloaded_setup() { # Delete the old output file. $run $rm $output - if test -n "$compile_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command" + if test -n "$shlibpath"; then + compile_command="$shlibpath_var=\"$shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$runpath_var"; then @@ -2964,6 +2963,12 @@ libdir='$install_libdir' link_command=\"$link_command\" link_dir=\"$link_dir\"\ " + + $rm "$output_objdir/$outputname"i + sed -e 's/^installed=no$/installed=yes/' \ + -e "s%^dependency_libs=\(.*\)%dependency_libs='$newdependency_libs'%" \ + -e 's/^link_\(.*\)//' \ + < "$output" > "$output_objdir/$outputname"i || exit 1 fi # Do a symbolic link so that the libtool archive can be found in @@ -3229,7 +3234,7 @@ link_dir=\"$link_dir\"\ done IFS="$save_ifs" fi - + # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do @@ -3248,19 +3253,12 @@ link_dir=\"$link_dir\"\ ;; esac done - + # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i - $show "Creating $instname" - $rm "$instname" - sed -e 's/^installed=no$/installed=yes/' \ - -e "s%^dependency_libs=\(.*\)%dependency_libs='$newdependency_libs'%" \ - -e 's/^link_\(.*\)//' "$file" > "$instname" $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? - $show "$rm $instname" - $rm "$instname" # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" diff --git a/mdemo/Makefile.am b/mdemo/Makefile.am index e1a5a28c1..569000dfb 100644 --- a/mdemo/Makefile.am +++ b/mdemo/Makefile.am @@ -16,11 +16,11 @@ libfoo2_la_LDFLAGS = $(LIBADD_M) -module noinst_HEADERS = foo.h -bin_PROGRAMS = mdemo mdemo.debug +bin_PROGRAMS = mdemo mdemo.static -../libltdl/libltdlc.la: ../libtool ../libltdl/libtool \ +../libltdl/libltdl.la: ../libtool ../libltdl/libtool \ $(srcdir)/../libltdl/ltdl.c $(srcdir)/../libltdl/ltdl.h - (cd ../libltdl; $(MAKE) libltdlc.la) + (cd ../libltdl; $(MAKE) libltdl.la) # Without the following line, the check may fail if libltdl/libtool is # removed after libltdl is configured ../libltdl/libtool: @@ -30,11 +30,11 @@ mdemo_SOURCES = main.c mdemo_LDFLAGS = -export-dynamic ## FIXME: remove this when libtool and libltdl ## handle dependencies of modules ## The quotes around -dlopen below fool automake into accepting it -mdemo_LDADD = ../libltdl/libltdlc.la "-dlopen" foo1.la "-dlopen" libfoo2.la -mdemo_DEPENDENCIES = ../libltdl/libltdlc.la foo1.la libfoo2.la - -# Create an easier-to-debug version of mdemo. -mdemo_debug_SOURCES = $(mdemo_SOURCES) -mdemo_debug_LDFLAGS = $(STATIC) $(mdemo_LDFLAGS) -mdemo_debug_LDADD = $(mdemo_LDADD) -mdemo_debug_DEPENDENCIES = $(mdemo_DEPENDENCIES) +mdemo_LDADD = ../libltdl/libltdl.la "-dlopen" foo1.la "-dlopen" libfoo2.la +mdemo_DEPENDENCIES = ../libltdl/libltdl.la foo1.la libfoo2.la + +# Create a statically linked version of mdemo. +mdemo_static_SOURCES = $(mdemo_SOURCES) +mdemo_static_LDFLAGS = $(STATIC) $(mdemo_LDFLAGS) +mdemo_static_LDADD = $(mdemo_LDADD) +mdemo_static_DEPENDENCIES = $(mdemo_DEPENDENCIES) diff --git a/tests/demo-exec.test b/tests/demo-exec.test index afe5912ae..bdf61bc07 100755 --- a/tests/demo-exec.test +++ b/tests/demo-exec.test @@ -20,9 +20,9 @@ fi echo "Executing uninstalled programs in ../demo" status=0 -if ../demo/hell.debug| grep 'Welcome to GNU Hell'; then : +if ../demo/hell.static| grep 'Welcome to GNU Hell'; then : else - echo "$0: cannot execute ../demo/hell.debug" 1>&2 + echo "$0: cannot execute ../demo/hell.static" 1>&2 status=1 fi diff --git a/tests/demo-inst.test b/tests/demo-inst.test index 3e99e5e70..419cafdfe 100755 --- a/tests/demo-inst.test +++ b/tests/demo-inst.test @@ -25,9 +25,9 @@ $make install || exit 1 echo "= Executing installed programs" status=0 -if $prefix/bin/hell.debug | grep 'Welcome to GNU Hell'; then : +if $prefix/bin/hell.static | grep 'Welcome to GNU Hell'; then : else - echo "$0: cannot execute $prefix/bin/hell.debug" 1>&2 + echo "$0: cannot execute $prefix/bin/hell.static" 1>&2 status=1 fi diff --git a/tests/demo.test b/tests/demo.test index 25b0ce8d3..072cb6809 100644 --- a/tests/demo.test +++ b/tests/demo.test @@ -55,7 +55,8 @@ fi if $prefix/bin/hell | grep 'GNU Hell'; then : else - echo "$0: warning: cannot execute $prefix/bin/hell" 1>&2 + echo "$0: cannot execute $prefix/bin/hell" 1>&2 + exit 1 fi echo "= Running make uninstall in ../demo" diff --git a/tests/mdemo-conf.test b/tests/mdemo-conf.test index 28c39ff58..d74b13563 100755 --- a/tests/mdemo-conf.test +++ b/tests/mdemo-conf.test @@ -1,5 +1,5 @@ #! /bin/sh -# mdemo-conf.test - try configuring the ../libltdl and ../mdemo subdirectories +# mdemo-conf.test - try configuring the ../mdemo subdirectory # Test script header. need_prefix=yes diff --git a/tests/mdemo-exec.test b/tests/mdemo-exec.test index d8651f033..a7d241e42 100755 --- a/tests/mdemo-exec.test +++ b/tests/mdemo-exec.test @@ -20,9 +20,9 @@ fi echo "Executing uninstalled programs in ../mdemo" status=0 -if ../mdemo/mdemo.debug ../mdemo/foo1.la ../mdemo/libfoo2.la; then : +if ../mdemo/mdemo.static ../mdemo/foo1.la ../mdemo/libfoo2.la; then : else - echo "$0: cannot execute ../mdemo/mdemo.debug" 1>&2 + echo "$0: cannot execute ../mdemo/mdemo.static" 1>&2 status=1 fi diff --git a/tests/mdemo-inst.test b/tests/mdemo-inst.test index c4fd7fab7..fcd4025df 100755 --- a/tests/mdemo-inst.test +++ b/tests/mdemo-inst.test @@ -26,9 +26,9 @@ $make install || exit 1 echo "= Executing installed programs" status=0 -if $prefix/bin/mdemo.debug $prefix/lib/foo1.la $prefix/lib/libfoo2.la; then : +if $prefix/bin/mdemo.static $prefix/lib/foo1.la $prefix/lib/libfoo2.la; then : else - echo "$0: cannot execute $prefix/bin/mdemo.debug" 1>&2 + echo "$0: cannot execute $prefix/bin/mdemo.static" 1>&2 status=1 fi diff --git a/tests/mdemo-shared.test b/tests/mdemo-shared.test index f1b3feea1..9f1d3a557 100755 --- a/tests/mdemo-shared.test +++ b/tests/mdemo-shared.test @@ -1,5 +1,5 @@ #! /bin/sh -# mdemo-conf.test - try configuring the ../libltdl and ../mdemo subdirectories +# mdemo-conf.test - try configuring the ../mdemo subdirectory # Test script header. need_prefix=yes diff --git a/tests/mdemo-static.test b/tests/mdemo-static.test index b063fc5cd..b6ecb5ec3 100755 --- a/tests/mdemo-static.test +++ b/tests/mdemo-static.test @@ -1,5 +1,5 @@ #! /bin/sh -# mdemo-conf.test - try configuring the ../libltdl and ../mdemo subdirectories +# mdemo-conf.test - try configuring the ../mdemo subdirectory # Test script header. need_prefix=yes diff --git a/tests/mdemo.test b/tests/mdemo.test index 225853b19..9af96cef7 100644 --- a/tests/mdemo.test +++ b/tests/mdemo.test @@ -31,15 +31,15 @@ make || exit 1 # Try running the program. echo "= Executing uninstalled programs" -if ./hell.debug | grep 'GNU Hell'; then : +if ./mdemo.static foo1.la libfoo2.la; then : else - echo "$0: cannot execute ./hell.debug" 1>&2 + echo "$0: cannot execute ./mdemo.static" 1>&2 exit 1 fi -if ./hell | grep 'GNU Hell'; then : +if ./mdemo foo1.la libfoo2.la; then : else - echo "$0: cannot execute ./hell" 1>&2 + echo "$0: cannot execute ./mdemo" 1>&2 exit 1 fi @@ -47,15 +47,16 @@ echo "= Running make install in ../mdemo" make install || exit 1 echo "= Executing installed programs" -if $prefix/bin/hell.debug | grep 'GNU Hell'; then : +if $prefix/bin/mdemo.static $prefix/lib/foo1.la $prefix/lib/libfoo2.la; then : else - echo "$0: cannot execute $prefix/bin/hell.debug" 1>&2 + echo "$0: cannot execute $prefix/bin/mdemo.static" 1>&2 exit 1 fi -if $prefix/bin/hell | grep 'GNU Hell'; then : +if $prefix/bin/mdemo $prefix/lib/foo1.la $prefix/lib/libfoo2.la; then : else - echo "$0: warning: cannot execute $prefix/bin/hell" 1>&2 + echo "$0: cannot execute $prefix/bin/mdemo" 1>&2 + exit 1 fi echo "= Running make uninstall in ../mdemo"