]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Merged HEAD into ild-branch: mainly for this --
authorGary V. Vaughan <gary@gnu.org>
Tue, 26 Jan 1999 15:09:37 +0000 (15:09 +0000)
committerGary V. Vaughan <gary@gnu.org>
Tue, 26 Jan 1999 15:09:37 +0000 (15:09 +0000)
* configure.in:  It seems Alexandre accidentally removed the
AC_SUBST(pkgdatadir) line recently which breaks libtoolize.
Reverted that small change.

13 files changed:
ChangeLog
Makefile.am
THANKS
commit
doc/libtool.texi
libltdl/configure.in
libltdl/ltdl.c
libltdl/ltdl.h
ltconfig.in
ltmain.in
mail/LTLIBOBJ
mkstamp [new file with mode: 0755]
tests/Makefile.am

index ce2b7c292660413e237c44838d67d894e1b032ed..95dc9b43684a925365e446d09f2f0c9d0a2f9853 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,87 @@
+1999-01-26  Gary V. Vaughan  <gvaughan@oranda.demon.co.uk>
+       
+       * configure.in:  It seems Alexandre accidentally removed the
+       AC_SUBST(pkgdatadir) line recently which breaks libtoolize.
+       Reverted that small change.
+
+1999-01-25  Alexandre Oliva  <oliva@dcc.unicamp.br>
+
+       * libltdl/ltdl.c (find_module): test old_name and dlname for NULL, 
+       not len==0
+
+       * libltdl/configure.in (libltdl_cv_objdir): yes, appending the "/" 
+       in configure.in was much simpler
+       * libltdl/ltdl.c (objdir): ditto
+
+       * libltdl/ltdl.c (objdir): string collation isn't portable; strcat 
+       "/" explicitly.  Or should this be moved to configure.in?
+
+1999-01-25  Thomas Tanner  <tanner@gmx.de>
+
+       * libltdl/ltdl.c: allocate the variables in lt_dlopen() dynamically
+         
+1999-01-25  Alexandre Oliva  <oliva@dcc.unicamp.br>
+
+       * ltmain.in (file_magic): use egrep instead of expr to support
+       more general regular expressions
+       (file_regex): remove it; the name is misleading, it's not used
+       anywhere, and probably will never be
+       * ltconfig.in, doc/libtool.texi: ditto
+       * ltconfig.in (linux-gnu*, deplibs_check_method): extend regex to 
+       support `LSB dynamic lib' in the output of `file'
+       Reported by Scott D. Heavner <sdh@po.cwru.edu>
+       
+       * ltmain.in (dependency_libs, xrpath): add -R switches to
+       dependency_libs only just before creating the .la file; they
+       should not be passed to the C compiler or linker at
+       library-creation time, since we don't know whether it is supported
+
+       * ltconfig.in (freebsd2.2*, hardcode_minus_L): for FreeBSD 2.2.6,
+       this must be `no'
+
+       * mkstamp: move the sed script to extract revision and date
+       information into a separate shell-script, so that we can break
+       lines between commands; FreeBSD's sed doesn't like `;' after `t'
+       Reported by Axel Thimm <Axel.Thimm@physik.fu-berlin.de>
+       * Makefile.am: use mkstamp
+       * THANKS: added Axel Thimm
+       
+       * ltmain.in: don't try to use .o instead of .lo just because
+       there's no PIC flag.  It loses if --disable-static, and there's
+       not much point if we're referring to the same file anyway...
+
+       * ltmain.in (pass_all=none, droppeddeps): set only if deplibs was
+       non-empty
+
+1999-01-24  Thomas Tanner  <tanner@gmx.de>
+
+       * libltdl/ltdl.c: minor bugfixes, append a "/" the search 
+         directory only if necessary
+       * ltconfig.in: added support for FreeBSD >= 3.0
+         (patch from Kurt D. Zeilenga)
+       * THANKS: added Kurt D. Zeilenga
+
+1999-01-24  Thomas Tanner  <tanner@gmx.de>
+
+       * doc/libtool.texi (libltdl): list supported dlopen mechanisms,
+         added function lt_dlopenext(), removed reference to 
+         LTDL_PRELOADED_SYMBOLS in LTDL_SET_PRELOADED_SYMBOLS
+       * libltdl/ltdl.c: partially reverted Alexandre's dynamic string
+         allocation change (it was not necessary and the code was unreadable),
+         cleanups, removed usr_search_path_size, renamed usr_search_path
+         to user_search_path, in find_module() also check for moved
+         modules, merged find_file() and find_library(),
+         added lt_dlopenext(), in lt_dladdsearchdir() no longer reset
+         the search path if 'search_dir' == NULL and don't use realloc()
+         (might not be available on all platforms),
+         removed __P((void)) in the declaration of lt_dlgetsearchpath()
+       * libltdl/ltdl.h: added lt_dlopenext()
+       * ltconfig.in: AIX archive commands were broken,
+         fixed a MAJOR bug in global_symbol_pipe which caused
+         "demo-shared.test;demo-make.test" to fail (libtool must not extract
+         undefined symbols of libraries, i.e. symcode must not contain 'U')
+       * tests/Makefile.am (clean-local): "make distclean" in cdemo, too
+
 1999-01-22  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * Makefile.am (ltconfig, ltmain.sh): add ChangeLog Revision to
index ba6f0fdb8fa9baa63c2a1f5798ae8d6703e7f716..4bac3855a7f5539c4994f0c63dc77d7c78f0c091 100644 (file)
@@ -61,8 +61,7 @@ update-timestamps:
 # Line numbering transliterated from a section in autoconf (Autoconf 2.12).
 $(srcdir)/ltconfig: $(srcdir)/ltconfig.in $(top_srcdir)/configure.in $(TSDEPS)
        rm -f ltconfig.T
-       date=`sed 's%.*\$$''Revision: \([^$$]*\) \$$ \$$''Date: \([^$$]*\) \$$.*% (\1 \2)%;t end;d;: end' \
-               < $(srcdir)/ChangeLog` && \
+       date=`$(SHELL) $(srcdir)/mkstamp < $(srcdir)/ChangeLog` && \
        $(AWK) '/@LINENO@/ { printf "%d:", NR } { print }' $(srcdir)/ltconfig.in | \
          sed -e 's/@''PACKAGE@/@PACKAGE@/' -e 's/@''VERSION@/@VERSION@/' \
              -e "s%@""TIMESTAMP@%$$date%" \
@@ -74,8 +73,7 @@ $(srcdir)/ltconfig: $(srcdir)/ltconfig.in $(top_srcdir)/configure.in $(TSDEPS)
 
 $(srcdir)/ltmain.sh: $(srcdir)/ltmain.in $(top_srcdir)/configure.in $(TSDEPS)
        rm -f ltmain.shT
-       date=`sed 's%.*\$$''Revision: \([^$$]*\) \$$ \$$''Date: \([^$$]*\) \$$.*% (\1 \2)%;t end;d;: end' \
-               < $(srcdir)/ChangeLog` && \
+       date=`$(SHELL) $(srcdir)/mkstamp < $(srcdir)/ChangeLog` && \
        sed -e 's/@''PACKAGE@/@PACKAGE@/' -e 's/@''VERSION@/@VERSION@/' \
            -e "s%@""TIMESTAMP@%$$date%" $(srcdir)/ltmain.in > ltmain.shT
        mv -f ltmain.shT $@ || \
diff --git a/THANKS b/THANKS
index d21d953ddcada1d5f2dd19c9a34c8cca437c693c..948c59cabac67b80799360fd81e4207bcf970717 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -10,6 +10,7 @@ and generally assist in the libtool maintainership process:
 
 Akim Demaille <demaille@inf.enst.fr>
 Andrey Slepuhin <pooh@msu.ru>
+Axel Thimm <Axel.Thimm@physik.fu-berlin.de>
 Bruno Haible <haible@ilog.fr>
 Carl D. Roth <roth@cse.ucsc.edu>
 Charles S. Kerr <cskerr@delenn.jccbi.gov>
@@ -26,6 +27,7 @@ Joel N. Weber II <devnull@gnu.org>
 Joseph Beckenbach III <jrb3@best.com>
 Karl Berry <kb@cs.umb.edu>
 Kenneth Albanowski <kjahds@kjahds.com>
+Kurt D. Zeilenga <Kurt@OpenLDAP.Org>
 Manfred Weichel <Manfred.Weichel@pdb.siemens.de>
 Marc J. Fraioli <fraioli@dg-rtp.dg.com>
 Mark Elbrecht <snowball3@usa.net>
diff --git a/commit b/commit
index e3dce8259b7b581b885de909a624560e0f96f0ff..5d3a1e34812e55b4e55bf2ff0ca36659e6e8a221 100755 (executable)
--- a/commit
+++ b/commit
@@ -171,7 +171,7 @@ $repeat && break
 
 $update && \
 if echo "$name: checking for conflicts..." >&2
-   (cvs $cvsopt -n update $updateopt ${1+"$@"} \
+   (cvs $cvsopt -n update $updateopt ${1+"$@"} 2>/dev/null\
     | while read line; do
        echo "$line"
        echo "$line" >&3
index b08dd63d347e65b79ed6434295aa11526da15d0f..0d16e818aeb1fdbf042baf2fa782aa668e7d7b6d 100644 (file)
@@ -2536,6 +2536,22 @@ distributed with applications that need dlopening functionality.
 On some platforms, whose dynamic linkers are too limited for a simple 
 implementation of @file{libltdl} services, it requires GNU DLD.
 
+@noindent
+Libltdl supports currently the following dynamic linking mechanims:
+
+@itemize @bullet
+@item
+dlopen (Solaris, Linux and various BSD flavors)
+@item
+shl_load (HP-UX)
+@item
+LoadLibrary (Win16 and Win32)
+@item
+GNU DLD (emulates dynamic linking for static libraries)
+@item
+libtool's dlpreopen (see @pxref{Dlpreopening})
+@end itemize
+
 @menu
 * Libltdl's interface::         How to use libltdl in your programs.
 * Modules for libltdl::         Creating modules that can be @code{dlopen}ed.
@@ -2561,21 +2577,19 @@ Note that libltdl is not threadsafe, i.e. a multithreaded application
 has to use a mutex for libltdl.
 
 @noindent
-The following types are defined by libltdl:
+The following types are defined in @file{ltdl.h}:
 
 @table @code
 @item lt_ptr_t
 @code{lt_ptr_t} is a generic pointer.
 
 @item lt_dlhandle
-@code{lt_dlhandle} is a module "handle" used by @code{lt_dlopen},
-@code{lt_dlclose} and @code{lt_dlsym}. Every dlopened module has
-a handle associated with it.
+@code{lt_dlhandle} is a module "handle". 
+Every dlopened module has a handle associated with it.
 
 @item lt_dlsymlist
 @code{lt_dlsymlist} is a symbol list for dlpreopened modules.
-This structure is described in @pxref{Dlpreopening} and is 
-used by @code{lt_dlpreload} and @code{lt_dlpreload_default}.
+This structure is described in @pxref{Dlpreopening}.
 @end table
 
 @noindent
@@ -2596,7 +2610,7 @@ Return 0 on success, otherwise the number of errors.
 @end deftypefun
 
 @deftypefun lt_dlhandle lt_dlopen (const char *@var{filename})
-Open the module whose name is derived from @var{filename} and return a
+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.  
 
@@ -2630,21 +2644,24 @@ e.g. "/usr/lib/mypkg:/lib/foo".
  
 If the same module is loaded several times, the same handle is returned.
 If @code{lt_dlopen} fails for any reason, it returns NULL.
+@end deftypefun
+
+@deftypefun lt_dlhandle lt_dlopenext (const char *@var{filename})
+The same as @code{lt_dlopen}, except that it tries to append
+different file name extensions to the file name.
+If the file with the file name @var{filename} cannot be found
+libltdl tries to append the following extensions:
+
+@enumerate 1
+@item the libtool archive extension @samp{.la}
+@item the extension used for native dynamic libraries on the host platform, 
+e.g., @samp{.so}, @samp{.sl}, etc.
+@end enumerate
 
-@code{lt_dlopen} will preferentially open libtool modules.  Therefore,
-if the @var{filename} does not end with the libtool archive extension,
-@samp{".la"}, @code{lt_dlopen} will automatically search for a libtool
-module by appending @samp{".la"} to the @var{filename}.  If this fails,
-it assumes the @var{filename} refers to a native dynamic library, so
-tries to locate a library with the given name.  If even this fails,
-@code{lt_dlopen} will try to append to @var{filename} the extension used
-for native dynamic libraries in the host platform, e.g., @samp{".so"},
-@samp{".sl"}, etc.
-
-This lookup strategy was designed to allow programs that have knowledge
-about native dynamic libraries naming conventions to be able to dlopen
-such libraries directly, and to allow programs that don't have this
-knowledge to let libltdl take care of this for them.
+This lookup strategy was designed to allow programs that don't 
+have knowledge about native dynamic libraries naming conventions 
+to be able to @code{dlopen} such libraries as well as libtool modules
+transparently.
 @end deftypefun
 
 @deftypefun int lt_dlclose (lt_dlhandle @var{handle})
@@ -2687,8 +2704,8 @@ Return 0 on success.
 
 @defmac LTDL_SET_PRELOADED_SYMBOLS()
 Set the default list of preloaded symbols.
-Should be used together with @code{LTDL_PRELOADED_SYMBOLS}
-in your program to initialize libltdl's list of preloaded modules.
+Should be used in your program to initialize libltdl's 
+list of preloaded modules.
 
 @example
 #include <ltdl.h>
@@ -3124,33 +3141,21 @@ are included in @samp{$archive_cmds} somewhere and also sets the
 @vindex file_magic
 @vindex file_magic_command
 looks in the library link path for libraries that have the right
-libname.  Then it runs @samp{$file_magic_command} on the library and checks
-for a match against [regex] using expr.  I currently have linux-elf looking
-for the string: "ELF [0-9][0-9]*-bit [LM]SB shared object" on the output of
-@samp{file}, and some of the win32 ports looking for the string: "file format
-pei*-i386.*architecture: i386" on the output of @samp{objdump -f}.
-This is option that works best I think.
-
-@item file_regex
-@vindex file_regex
-will look for a filename in the link path.  It doesn't take an argument
-because I use the @samp{libname_spec} and @samp{library_names_spec}
-variables to create the string to look for.  I don't like it because
-symlinks and random files can make it give false positives.
+libname.  Then it runs @samp{$file_magic_command} on the library and
+checks for a match against @samp{regex} using @code{egrep}.
 
 @item test_compile 
 @vindex test_compile
-handles @samp{-L} correctly, I hope.  It also takes the names of it's
-libraries from libname_spec instead of a hardcoded lib`expr $a_deplib :
-'-l/(.*/)'`.so line.
+handles @samp{-L} correctly, I hope.  It also takes the names of its
+libraries from @samp{libname_spec} instead of a hardcoded @code{lib`expr
+$a_deplib : '-l/(.*/)'`.so} line.
 
 @item pass_all
 @vindex pass_all
-will pass everything without any checking.  I put it in because osf3&4
-appear to be treated that way right now...  It might be wise to perform
-checks here to see if the libraries exist on the system, but I don't
-know how osf3&4 handle that, so I thought it would be better just to do
-it the way the current code does.
+will pass everything without any checking.  This may work on platforms
+in which code is position-independent by default and inter-library
+dependencies are properly supported by the dynamic linker, for example,
+on DEC OSF/1 3 and 4.
 
 @item none
 @vindex none
index 1f4a367f755bdcb383f05e459c8334ad2b425e11..0c9e55e7873ff87cd44208046d62d991b52c232c 100644 (file)
@@ -75,7 +75,7 @@ libltdl_cv_objdir=`cat conftest`
 rm -f conftest
 ])
 test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
-AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir")
+AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/")
 
 AC_HEADER_STDC
 AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h)
index a655cd484195c639f72bf1fc84879a9020488d8d..235bf873865b3346a4ae12fba7ba0784bb1a54ac 100644 (file)
@@ -72,9 +72,11 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #define LTDL_SYMBOL_LENGTH     128
 
 #undef LTDL_SYMBOL_OVERHEAD
-/* This accounts for the _LTX_ separator and the string terminator */
-#define LTDL_SYMBOL_OVERHEAD   6
+/* 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 *unknown_error = "unknown error";
 static const char *dlopen_not_supported_error = "dlopen support not available";
@@ -86,6 +88,11 @@ 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 */
+const lt_dlsymlist lt_preloaded_symbols[1] = { { 0, 0 } };
+#endif
+
 static const char *last_error = 0;
 
 typedef struct lt_dltype_t {
@@ -540,7 +547,7 @@ presym_init ()
        return 0;
 }
 
-static int /* not all compilers support void */
+static int
 presym_free_symlists ()
 {
        lt_dlsymlists_t *lists = preloaded_symbols;
@@ -658,8 +665,7 @@ presym = { LTDL_TYPE_TOP, 0, presym_init, presym_exit,
 #undef LTDL_TYPE_TOP
 #define LTDL_TYPE_TOP &presym
 
-static char *usr_search_path;
-static int usr_search_path_size = 0;
+static char *user_search_path = 0;
 static lt_dlhandle handles = 0;
 static int initialized = 0;
 
@@ -678,9 +684,7 @@ lt_dlinit ()
                return 0;
        }
        handles = 0;
-       if (usr_search_path)
-               free(usr_search_path);
-       usr_search_path = 0; /* empty search path */
+       user_search_path = 0; /* empty search path */
 
        while (*type) {
                if ((*type)->mod_init())
@@ -719,11 +723,6 @@ lt_dlpreload_default (preloaded)
        return 0;
 }
 
-#ifndef HAVE_PRELOADED_SYMBOLS
-/* If libtool won't define it, we'd better do */
-const lt_dlsymlist lt_preloaded_symbols[1] = { { 0, 0 } };
-#endif
-
 int
 lt_dlexit ()
 {
@@ -775,164 +774,135 @@ tryall_dlopen (handle, filename)
                return 0;
        }
        
-       (*handle)->filename = strdup(filename);
-       if (!(*handle)->filename)
+       cur = *handle;
+       cur->filename = strdup(filename);
+       if (!cur->filename) {
+               last_error = memory_error;
                return 1;
+       }
        while (type) {
-               if (type->lib_open(*handle, filename) == 0)
+               if (type->lib_open(cur, filename) == 0)
                        break;
                type = type->next;
        }
        if (!type) {
-               free((*handle)->filename);
+               free(cur->filename);
                return 1;
        }
-       (*handle)->type = type;
+       cur->type = type;
        last_error = saved_error;
        return 0;
 }
 
 static int
-find_module (handle, dir, dlname, old_name)
+find_module (handle, dir, libdir, dlname, old_name, installed)
        lt_dlhandle *handle;
        const char *dir;
+       const char *libdir;
        const char *dlname;
        const char *old_name;
+       int installed;
 {
-       /* search for old library first; if it was dlpreopened, we
-           want the preopened version of it, even if a dlopenable
-           module is available */
+       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 */
        if (old_name && tryall_dlopen(handle, old_name) == 0)
                return 0;
-
-       /* search a module */
+       /* try to open the dynamic library */
        if (dlname) {
-               char *filename = malloc(strlen(dir)+1+strlen(dlname)+1);
-
-               if (!filename) {
-                       last_error = memory_error;
-                       return 1;
+               /* try to open the installed module */
+               if (installed && 
+                   strlen(libdir)+1+strlen(dlname) < LTDL_FILENAME_MAX) {
+                       strcpy(filename, libdir);
+                       strcat(filename, "/");
+                       strcat(filename, dlname);
+                       if (tryall_dlopen(handle, filename) == 0)
+                               return 0;
                }
-               strcpy(filename, dir);
-               strcat(filename, "/");
-               strcat(filename, dlname);
-               if (tryall_dlopen(handle, filename) == 0) {
-                       free(filename);
-                       return 0;
+               /* try to open the not-installed module */
+               if (!installed &&
+                   strlen(dir)+strlen(objdir)+strlen(dlname)
+                               < LTDL_FILENAME_MAX) {
+                       strcpy(filename, dir);
+                       strcat(filename, objdir);
+                       strcat(filename, dlname);
+                       if (tryall_dlopen(handle, filename) == 0)
+                               return 0;
                }
-               free(filename);
-       }
-       last_error = file_not_found_error;
-       return 1;
-}
-
-#undef LTDL_CHECK_SIZE
-#define LTDL_CHECK_SIZE(buf_, size_, need_, ret) do {                  \
-        char **pbuf = &buf_; int *psize = &size_, need = need_;                \
-       if (need > *psize) {                                            \
-               if (*pbuf)                                              \
-                       free(*pbuf);                                    \
-               *pbuf = malloc(need);                                   \
-               if (!*pbuf) {                                           \
-                       last_error = memory_error;                      \
-                       return ret;                                     \
-               }                                                       \
-       }                                                               \
-} while(0)                                                              
-                       
-static int
-find_library (handle, basename, search_path)
-       lt_dlhandle *handle;
-       const char *basename;
-       const char *search_path;
-{
-       char    *filename = 0;
-       int size = 0;
-       const char *cur, *next;
-       int baselen;
-       
-       if (!search_path || !strlen(search_path)) {
-               last_error = file_not_found_error;
-               return 1;
-       }
-       cur = search_path;
-       baselen = strlen(basename);
-       while (cur) {
-               int lendir;
-               next = strchr(cur, ':');
-               if (next)
-                       lendir = next-cur;
-               else
-                       lendir = strlen(cur);
-               if (lendir == 0)
-                       continue;
-               LTDL_CHECK_SIZE(filename, size, \
-                               lendir + 1 + baselen + 1, 1);
-               strncpy(filename, cur, lendir);
-               if (next)
-                       cur = next+1;
-               else
-                       cur = 0;
-               filename[lendir] = '/';
-               strncpy(filename+lendir+1, basename, baselen+1);
-               if (tryall_dlopen(handle, filename) == 0) {
-                       free(filename);
-                       return 0;
+               /* hmm, maybe it was moved to another directory */
+               if (strlen(dir)+strlen(dlname) < LTDL_FILENAME_MAX) {
+                       strcpy(filename, dir);
+                       strcat(filename, dlname);
+                       if (tryall_dlopen(handle, filename) == 0)
+                               return 0;
                }
        }
-       free(filename);
        last_error = file_not_found_error;
        return 1;
 }
 
-static FILE *
-find_file (basename, search_path, pdir)
+static lt_ptr_t
+find_file (basename, search_path, pdir, handle)
        const char *basename;
        const char *search_path;
-       const char **pdir;
+       char *pdir;
+       lt_dlhandle *handle;
 {
-       char    *filename = 0;
-       int size = 0;
+       /* 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 baselen;
-       int overhead;
-
+       int     lendir;
+       
        if (!search_path || !strlen(search_path)) {
                last_error = file_not_found_error;
                return 0;
        }
        cur = search_path;
-       baselen = strlen(basename);
-       overhead = strlen(LTDL_OBJDIR)+1;
-       if (baselen > overhead)
-               overhead = baselen;
        while (cur) {
-               int lendir;
                next = strchr(cur, ':');
-               if (next)
-                       lendir = next-cur;
-               else
-                       lendir = strlen(cur);
-               if (lendir == 0)
-                       continue;
-               LTDL_CHECK_SIZE(filename, size, \
-                               lendir + 1 + overhead + 1, 0);
-               strncpy(filename, cur, lendir);
-               if (next)
+               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
+               } else {
+                       if (strlen(cur)+1 >= LTDL_FILENAME_MAX) {
+                               last_error = buffer_overflow_error;
+                               return 0;
+                       }
+                       strcpy(filename, cur);
                        cur = 0;
-               filename[lendir] = '/';
-               strncpy(filename+lendir+1, basename, baselen+1);
-               file = fopen(filename, LTDL_READTEXT_MODE);
-               if (file) {
-                       filename[lendir+1] = '\0';
-                       *pdir = filename;
-                       return file;
+               }
+               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;
+                               }
+                       }
                }
        }
-       free(filename);
        last_error = file_not_found_error;
        return 0;
 }
@@ -956,247 +926,267 @@ unload_deplibs(handle)
        return 0;
 }
 
-#undef LTDL_TRIM
-#define LTDL_TRIM(dest_, s_) do {                      \
-       char **dest = &(dest_);                         \
-       char *s = (s_);                                 \
-       int len = strlen(s);                            \
-                                                       \
-       if (*dest)                                      \
-               free(*dest);                            \
-       *dest = 0;                                      \
-                                                       \
-       if (len > 3 && s[0] == '\''                     \
-           && s[len-1] == '\n' && s[len-2] == '\'') {  \
-               *dest = malloc(len-2);                  \
-               if (!*dest)                             \
-                       goto trim_raise_memory_error;   \
-               strncpy(*dest, &s[1], len - 3);         \
-               (*dest)[len-3] = '\0';                  \
-       }                                               \
-} while(0)                                              
+static int
+trim (dest, s)
+       char **dest;
+       const char *s;
+{
+       char *tmp;
+       char *i = strrchr(s, '\'');
+       int len = strlen(s);
+
+       if (*dest)
+               free(*dest);
+       if (len > 3 && s[0] == '\'') {
+               tmp = malloc(i - s);
+               if (!tmp) {
+                       last_error = memory_error;
+                       return 1;
+               }
+               strncpy(tmp, &s[1], (i - s) - 1);
+               tmp[len-3] = '\0';
+               *dest = tmp;
+       } else
+               *dest = 0;
+       return 0;
+}
+
+static int
+free_vars(dlname, oldname, libdir, deplibs)
+       char *dlname;
+       char *oldname;
+       char *libdir;
+       char *deplibs;
+{
+       if (dlname)
+               free(dlname);
+       if (oldname)
+               free(oldname);
+       if (libdir)
+               free(libdir);
+       if (deplibs)
+               free(deplibs);
+       return 0;
+}
+
 
 lt_dlhandle
 lt_dlopen (filename)
        const char *filename;
 {
-       lt_dlhandle handle = 0;
-       char *dir = 0, *name = 0;
+       lt_dlhandle handle;
+       char    dir[LTDL_FILENAME_MAX];
        const char *basename, *ext;
        const char *saved_error = last_error;
+       char    *name = 0;
        
+       if (!filename) {
+               last_error = file_not_found_error;
+               return 0;
+       }
        basename = strrchr(filename, '/');
-       if (basename) {
+       if (basename)
                basename++;
-               dir = malloc(basename - filename + strlen(LTDL_OBJDIR) + 1);
-               if (!dir) {
-                       last_error = memory_error;
-                       return 0;
-               }
-               strncpy(dir, filename, basename-filename);
-               dir[basename-filename] = '\0';
-       } else
+       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) {
-               char    *dlname = 0, *old_name = 0;
-               char    *libdir = 0, *deplibs = 0;
+               /* this seems to be a libtool module */
                char    tmp[LTDL_FILENAME_MAX];
                FILE    *file;
                int     i;
+               char    *dlname = 0, *old_name = 0;
+               char    *libdir = 0, *deplibs = 0;
+               int     error = 0;
                /* if we can't find the installed flag, it is probably an
                   installed libtool archive, produced with an old version
                   of libtool */
-               int     installed=1; 
+               int     installed = 1; 
 
                /* extract the module name from the file name */
                if (strlen(basename) >= sizeof(tmp)) {
                        last_error = buffer_overflow_error;
                        return 0;
                }
-               strcpy(tmp, basename);
-               tmp[ext - basename] = '\0';
                /* canonicalize the module name */
                for (i = 0; i < ext - basename; i++)
-                       if (!isalnum(tmp[i]))
+                       if (isalnum(basename[i]))
+                               tmp[i] = basename[i];
+                       else
                                tmp[i] = '_';
+               tmp[ext - basename] = '\0';
                name = strdup(tmp);
                if (!name) {
                        last_error = memory_error;
                        return 0;
                }
+               /* now try to open the .la file */
                file = fopen(filename, LTDL_READTEXT_MODE);
-               if (!file && !dir) {
+               if (!file)
+                       last_error = file_not_found_error;
+               if (!file && !*dir) {
                        /* try other directories */
-                       file = find_file(basename, usr_search_path, &dir);
+                       file = (FILE*) find_file(basename, 
+                                                user_search_path,
+                                                dir, 0);
                        if (!file)
-                               file = find_file(basename,
+                               file = (FILE*) find_file(basename,
                                                 getenv("LTDL_LIBRARY_PATH"),
-                                                &dir);
+                                                dir, 0);
 #ifdef LTDL_SHLIBPATH_VAR
                        if (!file)
-                               file = find_file(basename,
+                               file = (FILE*) find_file(basename,
                                                 getenv(LTDL_SHLIBPATH_VAR),
-                                                &dir);
+                                                dir, 0);
 #endif
                }
                if (!file) {
-                       goto clean_up_dir;
+                       free(name);
+                       return 0;
                }
+               /* read the .la file */
                while (!feof(file)) {
                        if (!fgets(tmp, sizeof(tmp), file))
                                break;
                        if (tmp[0] == '\n' || tmp[0] == '#')
-                               ;
-                       else
+                               continue;
                        if (strncmp(tmp, "dlname=", 7) == 0)
-                               LTDL_TRIM(dlname, &tmp[7]);
+                               error = trim(&dlname, &tmp[7]);
                        else
                        if (strncmp(tmp, "old_library=", 12) == 0)
-                               LTDL_TRIM(old_name, &tmp[12]);
+                               error = trim(&old_name, &tmp[12]);
                        else
                        if (strncmp(tmp, "libdir=", 7) == 0)
-                               LTDL_TRIM(libdir, &tmp[7]);
+                               error = trim(&libdir, &tmp[7]);
                        else
                        if (strncmp(tmp, "dl_dependency_libs=", 20) == 0)
-                               LTDL_TRIM(deplibs, &tmp[20]);
+                               error = trim(&deplibs, &tmp[20]);
                        else
                        if (strcmp(tmp, "installed=yes\n") == 0)
                                installed = 1;
                        else
                        if (strcmp(tmp, "installed=no\n") == 0)
                                installed = 0;
-                       else
-                       if (0) {
-                       trim_raise_memory_error:
-                               fclose(file);
-                               goto handle_raise_memory_error;
-                       }
+                       if (error)
+                               break;
                }
                fclose(file);
-               
+               /* allocate the handle */
                handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
-               if (!handle) {
-               handle_raise_memory_error:
-                       last_error = memory_error;
-                       goto clean_up_vars;
+               if (!handle || error) {
+                       if (handle)
+                               free(handle);
+                       if (!error)
+                               last_error = memory_error;
+                       free_vars(dlname, old_name, libdir, deplibs);
+                       free(name);
+                       return 0;
                }
                handle->usage = 0;
-               if (deplibs && load_deplibs(handle, deplibs)) {
-               clean_up_handle:
-                       free(handle);
-                       handle = 0;
-                       goto clean_up_vars;
-               }
-               if (installed) {
-                       if (find_module(&handle, libdir, dlname, old_name)) {
-                       clean_up_deplibs:
+               if (load_deplibs(handle, deplibs) == 0) {
+                       if (find_module(&handle, dir, libdir, 
+                                       dlname, old_name, installed)) {
                                unload_deplibs(handle);
-                               goto clean_up_handle;
+                               error = 1;
                        }
-               } else {
-                       /* We dir is non-NULL, it has enough space for
-                          LTDL_OBJDIR: it was reserved in the
-                          beginning of the function or within
-                          find_file */
-                       if (dir)
-                               strcat(dir, LTDL_OBJDIR);
-                       if (find_module(&handle,
-                                       dir ? dir : LTDL_OBJDIR,
-                                       dlname, old_name))
-                               goto clean_up_deplibs;
+               } else
+                       error = 1;
+               if (error) {
+                       free(handle);
+                       free_vars(dlname, old_name, libdir, deplibs);
+                       free(name);
+                       return 0;
                }
-       clean_up_vars:
-               if (dlname)
-                       free(dlname);
-               if (old_name)
-                       free(old_name);
-               if (libdir)
-                       free(libdir);
-               if (deplibs)
-                       free(deplibs);
-               if (!handle)
-                       goto clean_up_dir;
        } else {
-               /* try to append libtool library extension */
-               char *newfilename = malloc(strlen(filename)+4);
-               if (!newfilename) {
-                       last_error = memory_error;
-                       goto clean_up_dir;
-               }
-               strcpy(newfilename, filename);
-               strcat(newfilename, ".la");
-               handle = lt_dlopen(newfilename);
-               free(newfilename);
-               if (handle)
-                       goto restore_error;
-
                /* not a libtool module */
                handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
                if (!handle) {
                        last_error = memory_error;
-                       goto clean_up_dir;
+                       return 0;
                }
                handle->usage = 0;
-               if (tryall_dlopen(&handle, filename)
-                   && (dir
-                       || (find_library(&handle, basename, usr_search_path)
-                           && find_library(&handle, basename,
-                                           getenv("LTDL_LIBRARY_PATH"))
+               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_library(&handle, basename,
-                                           getenv(LTDL_SHLIBPATH_VAR))
-#endif
-                               ))) {
-#ifdef LTDL_SHLIB_EXT
-                       newfilename = malloc(strlen(filename) +
-                                            strlen(LTDL_SHLIB_EXT) + 1);
-                       if (!newfilename) {
-                               last_error = memory_error;
-                               goto clean_up_hand;
-                       }
-                       strcpy(newfilename, filename);
-                       strcat(newfilename, LTDL_SHLIB_EXT);
-                       basename = newfilename + (basename - filename);
-                       if (tryall_dlopen(&handle, newfilename)
-                           && (dir
-                               || (find_library(&handle, basename, usr_search_path)
-                                   && find_library(&handle, basename,
-                                                   getenv("LTDL_LIBRARY_PATH"))
-#ifdef LTDL_SHLIBPATH_VAR
-                                   && find_library(&handle, basename,
-                                                   getenv(LTDL_SHLIBPATH_VAR))
-#endif
-                                       ))) {
-#endif
-                       clean_up_hand:
-                               free(handle);
-                               handle = 0;
-                               goto clean_up_dir;
-#ifdef LTDL_SHLIB_EXT
-                       }
+                    && find_file(basename, getenv(LTDL_SHLIBPATH_VAR),
+                                 0, &handle)
 #endif
+                   ))) {
+                       free(handle);
+                       return 0;
                }
        }
        if (!handle->usage) {
                handle->usage = 1;
+               handle->name = name;
                handle->next = handles;
                handles = handle;
-               handle->name = name;
-               name = 0;
        }
- restore_error:
        last_error = saved_error;
- clean_up_dir:
-       if (dir)
-               free(dir);
-       if (name)
-               free(name);
        return handle;
 }
 
+lt_dlhandle
+lt_dlopenext (filename)
+       const char *filename;
+{
+       lt_dlhandle handle;
+       char    tmp[LTDL_FILENAME_MAX];
+       int     len;
+       const char *saved_error = last_error;
+       
+       if (!filename) {
+               last_error = file_not_found_error;
+               return 0;
+       }
+       len = strlen(filename);
+       if (!len) {
+               last_error = file_not_found_error;
+               return 0;
+       }
+       /* try the normal file name */
+       handle = lt_dlopen(filename);
+       if (handle)
+               return handle;
+       /* try "filename.la" */
+       if (len+3 >= sizeof(tmp)) {
+               last_error = buffer_overflow_error;
+               return 0;
+       }
+       strcpy(tmp, filename);
+       strcat(tmp, ".la");
+       handle = lt_dlopen(tmp);
+       if (handle) {
+               last_error = saved_error;
+               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;
+       }
+       strcat(tmp, shlib_ext);
+       handle = lt_dlopen(tmp);
+       if (handle) {
+               last_error = saved_error;
+               return handle;
+       }
+#endif 
+       last_error = file_not_found_error;
+       return 0;
+}
+
 int
 lt_dlclose (handle)
        lt_dlhandle handle;
@@ -1258,7 +1248,7 @@ lt_dlsym (handle, symbol)
        if (lensym + LTDL_SYMBOL_OVERHEAD < LTDL_SYMBOL_LENGTH)
                sym = lsym;
        else
-               sym = malloc(lensym + LTDL_SYMBOL_OVERHEAD);
+               sym = malloc(lensym + LTDL_SYMBOL_OVERHEAD + 1);
        if (!sym) {
                last_error = buffer_overflow_error;
                return 0;
@@ -1305,33 +1295,26 @@ int
 lt_dladdsearchdir (search_dir)
        const char *search_dir;
 {
-       if (!search_dir) {
-               if (usr_search_path)
-                       free(usr_search_path);
-               usr_search_path = 0; /* reset the search path */
+       if (!search_dir || !strlen(search_dir))
                return 0;
-       }
-       if (!strlen(search_dir))
-               return 0;
-       if (!usr_search_path) {
-               usr_search_path_size = strlen(search_dir)+1;
-               usr_search_path = malloc(usr_search_path_size);
-               if (!usr_search_path) {
+       if (!user_search_path) {
+               user_search_path = strdup(search_dir);
+               if (!user_search_path) {
                        last_error = memory_error;
                        return 1;
                }
-               strcpy(usr_search_path, search_dir);
        } else {
-               int new_size = usr_search_path_size + strlen(search_dir) + 1;
-               char *new_search_path = realloc(usr_search_path, new_size);
+               char    *new_search_path = (char*)
+                       malloc(strlen(user_search_path) + 
+                               strlen(search_dir) + 1);
                if (!new_search_path) {
                        last_error = memory_error;
                        return 1;
                }
-               usr_search_path = new_search_path;
-               usr_search_path_size = new_size;
-               strcat(usr_search_path, ":");
-               strcat(usr_search_path, search_dir);
+               strcat(new_search_path, ":");
+               strcat(new_search_path, search_dir);
+               free(user_search_path);
+               user_search_path = new_search_path;
        }
        return 0;
 }
@@ -1340,22 +1323,19 @@ int
 lt_dlsetsearchpath (search_path)
        const char *search_path;
 {
-       if (usr_search_path)
-               free(usr_search_path);
-       usr_search_path = 0; /* reset the search path */
-       if (!search_path || !strlen(search_path)) {
+       if (user_search_path)
+               free(user_search_path);
+       user_search_path = 0; /* reset the search path */
+       if (!search_path || !strlen(search_path))
                return 0;
-       }
-       usr_search_path = strdup(search_path);
-       if (usr_search_path)
-               usr_search_path_size = strlen(usr_search_path)+1;
-       else
+       user_search_path = strdup(search_path);
+       if (!user_search_path)
                return 1;
        return 0;
 }
 
 const char *
-lt_dlgetsearchpath __P((void))
+lt_dlgetsearchpath ()
 {
-       return usr_search_path;
+       return user_search_path;
 }
index dbe1a0e6524fe132d45a2f492cf5050f9d04d691..07af535f93f773b5cb52bae182da22aa11008022 100644 (file)
@@ -79,6 +79,7 @@ _LTDLL_EXTERN int lt_dlpreload __P((const lt_dlsymlist *preloaded));
 _LTDLL_EXTERN int lt_dlpreload_default __P((const lt_dlsymlist *preloaded));
 _LTDLL_EXTERN int lt_dlexit __P((void));
 _LTDLL_EXTERN lt_dlhandle lt_dlopen __P((const char *filename));
+_LTDLL_EXTERN lt_dlhandle lt_dlopenext __P((const char *filename));
 _LTDLL_EXTERN int lt_dlclose __P((lt_dlhandle handle));
 _LTDLL_EXTERN lt_ptr_t lt_dlsym __P((lt_dlhandle handle, const char *name));
 _LTDLL_EXTERN const char *lt_dlerror __P((void));
index 5b93f339a256e371bbeb202330a9580ff40887d0..4d00f498168698944fbbd2700067f434fb5d7961 100755 (executable)
@@ -1146,7 +1146,7 @@ else
       fi
       archive_cmds='$CC -shared ${wl}-bnoentry -o $objdir/$soname $libobjs $deplibs'
     else
-      archive_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp        else cat $export_symbols > $lib.exp~
+      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'
       hardcode_direct=yes
@@ -1215,6 +1215,11 @@ else
     fi
     ;;
 
+  freebsd1*)
+    ld_shlibs=no
+    can_build_shared=no
+    ;;
+
   # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
   # support.  Future versions do this automatically, but an explicit c++rt0.o
   # does not break anything, and helps significantly (at the cost of a little
@@ -1223,7 +1228,7 @@ else
     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs /usr/lib/c++rt0.o'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
-    hardcode_minus_L=yes
+    hardcode_minus_L=no # verified on 2.2.6
     hardcode_shlibpath_var=no
     ;;
 
@@ -1235,8 +1240,8 @@ else
     hardcode_shlibpath_var=no
     ;;
 
-  # FreeBSD 3, at last, uses gcc -shared to do shared libraries.
-  freebsd3*)
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
     archive_cmds='$CC -shared -o $lib $libobjs $deplibs'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
@@ -1407,7 +1412,7 @@ echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
 # [They come from Ultrix.  What could be older than Ultrix?!! ;)]
 
 # Character class describing NM global symbol codes.
-symcode='[BCDEGRSTU]'
+symcode='[BCDEGRST]'
 
 # Regexp to match symbols that can be accessed directly from C.
 sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
@@ -1418,29 +1423,23 @@ symxfrm='\1 \1'
 # Define system-specific variables.
 case "$host_os" in
 aix*)
-  symcode='[BCDTU]'
+  symcode='[BCDT]'
+  ;;
+cygwin32* | mingw32*)
+  symcode='[ABCDGISTW]'
   ;;
 irix*)
-  # Cannot use undefined symbols on IRIX because inlined functions mess us up.
   symcode='[BCDEGRST]'
   ;;
 solaris*)
-  symcode='[BDTU]'
+  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
-  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.
   symcode='[ABCDGISTW]'
-  ;;
-esac
+fi
 
 # Try without a prefix undercore, then with it.
 for ac_symprfx in "" "_"; do
@@ -1600,16 +1599,13 @@ deplibs_check_method='unknown'
 # Need to set the preceding variable on all platforms that support
 # interlibrary dependencies.
 # 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't known.
+# `unknown' -- same as none, but documents that we really don't know.
 # 'pass_all' -- all dependencies passed with no checks.
 # 'test_compile' -- check by making test program.
-# 'file_regex' -- check by looking for filenames that look like the shared
-# library in the library path.
-# 'file_magic [regex]' -- check by looking for files in library path which
-# responds to the $file_magic_command with a given regex.  This is actually a
-# superset of the file_regex command.  If you have `file' or equivalent on
-# your system, you'll want to use this instead.
-# Notes: regexs are run through expr.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_command with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
 echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
 case "$host_os" in
 aix3*)
@@ -1670,7 +1666,11 @@ cygwin32* | mingw32*)
   shlibpath_var=PATH
   ;;
 
-freebsd2* | freebsd3*)
+freebsd1*)
+  dynamic_linker=no
+  ;;
+  
+freebsd*)
   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
   version_type=freebsd-$objformat
   case "$version_type" in
@@ -1734,7 +1734,7 @@ linux-gnu*)
   soname_spec='${libname}${release}.so$major'
   finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
-  deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+  deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
   file_magic_command=file
 
   if test -f /lib/ld.so.1; then
index cc9276b3f7542b8c510397e0e2f35895c62983a4..8f3534d4fa6d7aa5500c26f1a8ef5fd52ac485df 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -1201,14 +1201,6 @@ compiler."
        ;;
       esac
 
-      if test -n "$xrpath"; then
-       temp_xrpath=
-       for libdir in $xrpath; do
-         temp_xrpath="$temp_xrpath -R$libdir"
-       done
-       deplibs="$temp_xrpath $deplibs"
-      fi
-
       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
       if test "X$output_objdir" = "X$output"; then
        output_objdir="$objdir"
@@ -1636,10 +1628,6 @@ compiler."
 
       if test "$build_libtool_libs" = yes; then
        # Transform deplibs into only deplibs that can be linked in shared.
-       ## Gordon: Do you check for the existence of the libraries in deplibs
-       ## on the system?  That should maybe be merged in here someplace....
-       ## Actually: I think test_compile and file_magic do this... file_regex
-       ## sorta does this. Only pass_all needs to be changed.  -Toshio
        name_save=$name
        libname_save=$libname
        release_save=$release
@@ -1737,7 +1725,7 @@ EOF
          fi
          deplibs=$newdeplibs
          ;;
-       file_magic* | file_regex)
+       file_magic*)
          set dummy $deplibs_check_method
          file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
          for a_deplib in $deplibs; do
@@ -1745,15 +1733,7 @@ EOF
            # If $name is empty we are operating on a -L argument.
            if test "$name" != "" ; then
              libname=`eval \\$echo \"$libname_spec\"`
-             case "$deplibs_check_method" in
-               file_magic*)
-                 for i in $lib_search_path; do
-                  # This needs to be more general than file_regex in order to
-                  # catch things like glibc on linux.  Maybe file_regex
-                  # should be more general as well, but maybe not.  Since
-                  # library names are supposed to conform to
-                  # library_name_spec, I think file_regex should remain
-                  # strict.  What do you think Gordon?
+             for i in $lib_search_path; do
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
                    for potent_lib in $potential_libs; do
                      # Follow soft links.
@@ -1775,30 +1755,15 @@ EOF
                                   | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
                        esac
                      done
-                     file_output=`eval $file_magic_command \"\$potlib\" \
-                                  | sed '11,$d'`
-                     if test `expr "X$file_output" : "X.*$file_magic_regex"` -ne 0 ; then
+                     if eval $file_magic_command \"\$potlib\" \
+                        | sed '11,$d' \
+                        | egrep "$file_magic_regex" > /dev/null; then
                        newdeplibs="$newdeplibs $a_deplib"
                        a_deplib=""
                        break 2
                      fi
                    done
-                 done
-                 ;;
-               file_regex)
-                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
-                 set dummy $deplib_matches
-                 deplib_match=$2
-                 for i in $lib_search_path; do
-                   potential_libs=`ls $i/$deplib_match* 2>/dev/null`
-                   if test "$potential_libs" != "" ; then
-                     newdeplibs="$newdeplibs $a_deplib"
-                     a_deplib=""
-                     break
-                   fi
-                 done
-                 ;;
-             esac
+             done
              if test -n "$a_deplib" ; then
                droppeddeps=yes
                echo
@@ -1813,7 +1778,12 @@ EOF
            fi
          done # Gone through all deplibs.
          ;;
-       none | unknown | *) newdeplibs=""; droppeddeps=yes ;;
+       none | unknown | *) newdeplibs=""
+         if $echo "X$deplibs" | $Xsed -e 's/ -lc$//' -e 's/[   ]//g' \
+            | grep . >/dev/null; then
+           droppeddeps=yes
+         fi
+         ;;
        esac
        versuffix=$versuffix_save
        major=$major_save
@@ -1868,9 +1838,6 @@ EOF
          linknames="$linknames $link"
        done
 
-       # Use standard objects if they are PIC.
-       test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
        if test -n "$whole_archive_flag_spec"; then
          if test -n "$convenience"; then
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
@@ -2871,6 +2838,14 @@ fi\
       test "$build_old_libs" = yes && old_library="$libname.$libext"
       $show "creating $output"
 
+      if test -n "$xrpath"; then
+       temp_xrpath=
+       for libdir in $xrpath; do
+         temp_xrpath="$temp_xrpath -R$libdir"
+       done
+       dependency_libs="$temp_xrpath $dependency_libs"
+      fi
+
       # Only create the output if not a dry run.
       if test -z "$run"; then
        $echo > $output "\
index 09f735b8df5fb13754eb68507f0bbedb6a642e83..d149779534f37a49ee3e9cb27ba5aaaf4449c8d8 100644 (file)
@@ -178,3 +178,44 @@ P-mail: Akim Demaille, 107 rue Bobillot, F-75013 Paris, France
 E-mail: demaille@inf.enst.fr
 V-mail: +33 1 45 81 78 81
 
+Subject: Re: lazy question
+Date: Mon, 25 Jan 1999 11:38:41 +0000
+From: "Gary V. Vaughan" <gvaughan@oranda.demon.co.uk>
+Organization: Aethos Communication Systems Ltd.
+To: tromey@cygnus.com
+CC: Akim Demaille <demaille@inf.enst.fr>,
+     Erez Zadok <ezk@cs.columbia.edu>, bug-libtool@gnu.org,
+     automake@gnu.org, autoconf@gnu.org
+
+Tom Tromey wrote:
+>
+> >> AC_LIBOBJS(blah)
+>
+> Gary> Agreed.  Also added to the archive.
+>
+> I'm suprised this isn't already there, since this subject has come up
+> many times before.  I'm sure I mentioned it to Gord more than once.
+>
+> Basically, I think the right solution is to add some new
+> functionality to autoconf that would let a user defer a piece of code
+> to be run just before AC_OUTPUT.  Then the libtool macro would
+> arrange to defer computation (and AC_SUBSTitution) of LTLIBOBJS and
+> LTALLOCA until that time.
+
+That sounds like a good, general, solution to me.  I'm adding this mail
+to the libtool mail archive too =)O|
+
+> This probably isn't even that hard to do; I just haven't done it.  I
+> wonder if it is on Ben's to-do list?  Or perhaps one of the libtool
+> hackers could submit the patch?
+
+We are teetering on the edge of a 1.3 release, which must be compatible
+with autoconf-2.13 and automake-1.4.  After that, I will try to submit a
+patch to Ben (stop me if you have this in your pending queue!).
+
+> In any case I don't think it is an automake problem per se.
+
+Agreed.
+
+Cheers,
+        Gary.
diff --git a/mkstamp b/mkstamp
new file mode 100755 (executable)
index 0000000..08239af
--- /dev/null
+++ b/mkstamp
@@ -0,0 +1,37 @@
+#! /bin/sh
+
+# mkstamp - extract data from Revision and Date RCS tags in a file
+# Copyright (C) 1999 Free Software Foundation, Inc.
+# Alexandre Oliva <oliva@dcc.unicamp.br>
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This script expects to find a line containing both Revision and Date
+# tags, and it edits this line so that it looks line ` ($rev $date)'
+
+# Command-line arguments are passed down to sed; additional -e cmd
+# arguments are acceptable.  If no input filename is specified in the
+# command line, sed will read from stdin.
+
+exec sed -e '
+       s%.*\$''Revision: \([^$]*\) \$.*\$''Date: \([^$]*\) \$.*% (\1 \2)%
+       t end
+       d
+       : end' ${1+"$@"}
index a62438015f5290dfcb7bbd0ca48f74cc6ae2720e..776755cf9126330533b840a837c549498cfc2317 100644 (file)
@@ -34,5 +34,6 @@ EXTRA_DIST = defs $(TESTS)
 # We need to remove any files that the above tests created.
 clean-local:
        -test -f ../demo/Makefile && cd ../demo && $(MAKE) distclean
+       -test -f ../cdemo/Makefile && cd ../cdemo && $(MAKE) distclean
        -test -f ../mdemo/Makefile && cd ../mdemo && $(MAKE) distclean
        rm -rf _inst