* update all copyright notices to 2000

* doc/libtool.texi (using libltdl): document new lt_dlinfo struct,
  replace NULL with @code{NULL}, document lt_dlsetdata(),
  lt_dlgetdata() and lt_dlgetinfo()
* libltdl/Makefile.am: increment interface version number
* libltdl/configure.in: set version number to 1.1
* libltdl/ltdl.c: make some variables public by moving them
  to the info struct, add support for application specific data
  within module handles, new lt_dlsetdata(), lt_dlgetdata() and
  lt_dlgetinfo() functions,
  fix memory leaks, minor cleanups
* libltdl/ltdl.h: ditto
* mdemo/main.c: demonstrate use of lt_dlgetinfo,
  improved handling of errors

* ltconfig.in: set hardcode_into_libs = yes for GNU/Hurd, Linux
  and Solaris, only hardcode *all* run-paths if hardcode_into_libs
  is set to 'all', otherwise hardcode only user-specified rpaths
  into libraries
* ltmain.in: minor cleanups, we don't need to add user-specified
  rpaths to compile_rpath, finalize_rpath is sufficient

* ltconfig.in: transform linux* -> *linux-gnu* _after_ host_os has
  been set! (reported by Bruno Haible <haible@ilog.fr>)

* configure.in: AC_SUBST reload_flag, deplibs_check_method
  and file_magic_cmd

* README: use 'libtool --version' instead of 'ltconfig --version'
  (suggested by Francios Pinard <pinard@iro.umontreal.ca>
This commit is contained in:
Thomas Tanner 2000-01-13 00:28:09 +00:00 committed by Gary V. Vaughan
parent 397308770c
commit 47938d46eb
42 changed files with 283 additions and 168 deletions

View File

@ -1,3 +1,37 @@
2000-01-12 Thomas Tanner <tanner@ffii.org>
* update all copyright notices to 2000
* doc/libtool.texi (using libltdl): document new lt_dlinfo struct,
replace NULL with @code{NULL}, document lt_dlsetdata(),
lt_dlgetdata() and lt_dlgetinfo()
* libltdl/Makefile.am: increment interface version number
* libltdl/configure.in: set version number to 1.1
* libltdl/ltdl.c: make some variables public by moving them
to the info struct, add support for application specific data
within module handles, new lt_dlsetdata(), lt_dlgetdata() and
lt_dlgetinfo() functions,
fix memory leaks, minor cleanups
* libltdl/ltdl.h: ditto
* mdemo/main.c: demonstrate use of lt_dlgetinfo,
improved handling of errors
* ltconfig.in: set hardcode_into_libs = yes for GNU/Hurd, Linux
and Solaris, only hardcode *all* run-paths if hardcode_into_libs
is set to 'all', otherwise hardcode only user-specified rpaths
into libraries
* ltmain.in: minor cleanups, we don't need to add user-specified
rpaths to compile_rpath, finalize_rpath is sufficient
* ltconfig.in: transform linux* -> *linux-gnu* _after_ host_os has
been set! (reported by Bruno Haible <haible@ilog.fr>)
* configure.in: AC_SUBST reload_flag, deplibs_check_method
and file_magic_cmd
* README: use 'libtool --version' instead of 'ltconfig --version'
(suggested by Francios Pinard <pinard@iro.umontreal.ca>
2000-01-10 Gary V. Vaughan <gary@oranda.demon.co.uk>
* libltdl/ltdl.h (LTDL_DIRSEP_CHAR): Leave undefined when

2
NEWS
View File

@ -1,6 +1,6 @@
NEWS - list of user-visible changes between releases of GNU Libtool
New in 1.3d: 1999-??-??; CVS version 1.3c, Libtool team:
New in 1.3d: 2000-??-??; CVS version 1.3c, Libtool team:
* libltdl can now be built as a dll with win32.
* m4 macros needed to configure libltdl split out into libltdl/ltdl.m4.
* Start of support code for cross-compiling to win32.

2
README
View File

@ -64,4 +64,4 @@ If you have any suggestions or bug reports, or you wish to port
libtool to a new platform, please send electronic mail to the libtool
mailing list <libtool@gnu.org> or bug reports to <bug-libtool@gnu.org>.
Don't forget to mention the version of libtool that you are currently
using (by typing `ltconfig --version').
using (by typing `libtool --version').

View File

@ -18,7 +18,7 @@ for sub in libltdl demo depdemo mdemo cdemo; do
cd $sub
rm -f acinclude.m4
cat ../libtool.m4 > acinclude.m4
case "$sub" in libltdl) cat ../ltdl.m4 >> acinclude.m4 ;; esac
test "$sub" = libltdl && cat ../ltdl.m4 >> acinclude.m4
aclocal
test "$sub" = libltdl && autoheader
automake --gnits --add-missing

View File

@ -1,5 +1,5 @@
/* foo.c -- trivial test library
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.

View File

@ -1,5 +1,5 @@
/* foo.h -- interface to the libfoo* libraries
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.

View File

@ -1,5 +1,5 @@
/* main.c -- cdemo test program
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.

View File

@ -49,6 +49,9 @@ AC_SUBST(DLLTOOL)
AC_SUBST(FILE)
AC_SUBST(OBJDUMP)
AC_SUBST(AS)
AC_SUBST(reload_flag)
AC_SUBST(file_magic_cmd)
AC_SUBST(deplibs_check_method)
LIBTOOL_FLAGS="$libtool_flags"
AC_SUBST(LIBTOOL_FLAGS)

View File

@ -1,5 +1,5 @@
/* dlmain.c -- hello test program that uses simulated dynamic linking
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Copyright (C) 1996-2000 Free Software Foundation, Inc.
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* foo.c -- trivial test function for libfoo
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Copyright (C) 1996-2000 Free Software Foundation, Inc.
Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
This file is part of GNU Libtool.

View File

@ -1,5 +1,5 @@
/* foo.h -- interface to the libfoo library
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Copyright (C) 1996-2000 Free Software Foundation, Inc.
Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
This file is part of GNU Libtool.

View File

@ -1,5 +1,5 @@
/* hello.c -- trivial test function for libfoo
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Copyright (C) 1996-2000 Free Software Foundation, Inc.
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* main.c -- trivial hello test program
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Copyright (C) 1996-2000 Free Software Foundation, Inc.
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* l1.c -- trivial test library
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* l1.h -- interface to a trivial library
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* l2.c -- trivial test library
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* l2.h -- interface to a trivial library
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* l3.c -- trivial test library
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* l3.h -- interface to a trivial library
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* l4.c -- trivial test library
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* l4.h -- interface to a trivial library
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* main.c -- inter-library dependency test program
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* sysdep.h -- system dependent declarations
Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
Copyright (C) 1998-2000 Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify

View File

@ -24,7 +24,7 @@
@ifinfo
This file documents GNU Libtool @value{VERSION}
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Copyright (C) 1996-2000 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@ -59,7 +59,7 @@ approved by the Foundation.
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1996-1999 Free Software Foundation, Inc.
Copyright @copyright{} 1996-2000 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@ -2612,7 +2612,7 @@ burger$
Libtool provides special support for dlopening libtool object and
libtool library files, so that their symbols can be resolved @emph{even
on platforms without any @code{dlopen} and @code{dlsym}
functions.}.
functions}.
Consider the following alternative ways of loading code into your
program, in order of increasing ``laziness'':
@ -2823,6 +2823,16 @@ The following types are defined in @file{ltdl.h}:
Every dlopened module has a handle associated with it.
@end deftp
@deftypefn {Type} {struct} lt_dlinfo @{ @w{char *@var{filename};} @w{char *@var{name};} @w{int @var{ref_count};} @}
@code{lt_dlinfo} is used to store information about a module.
The @var{filename} attribute is a null-terminated character string of the
real module file name. If the module is a libtool module then @var{name}
is its module name (e.g. @code{"libfoo"} for @code{"dir/libfoo.la"}),
otherwise it is set to @code{NULL}.
The @var{ref_count} attribute is a reference counter that describes how often
the same module is currently loaded.
@end deftypefn
@deftp {Type} lt_dlsymlist
@code{lt_dlsymlist} is a symbol list for dlpreopened modules.
This structure is described in @pxref{Dlpreopening}.
@ -2858,7 +2868,7 @@ executable using this module was linked with the @code{-export-dynamic}
flag, then the global symbols in the executable will also be used to
resolve references in the module.
If @var{filename} is NULL and the program was linked with
If @var{filename} is @code{NULL} and the program was linked with
@code{-export-dynamic} or @code{-dlopen self}, @code{lt_dlopen} will
return a handle for the program itself, which can be used to access its
symbols.
@ -2885,7 +2895,7 @@ Each search path must be a colon-separated list of absolute directories,
for example, @code{"/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.
If @code{lt_dlopen} fails for any reason, it returns @code{NULL}.
@end deftypefun
@deftypefun lt_dlhandle lt_dlopenext (const char *@var{filename})
@ -2916,19 +2926,19 @@ Return 0 on success.
@deftypefun lt_ptr_t lt_dlsym (lt_dlhandle @var{handle}, const char *@var{name})
Return the address in the module @var{handle}, where the symbol given
by the null terminated string @var{name} is loaded.
If the symbol cannot be found, NULL is returned.
If the symbol cannot be found, @code{NULL} is returned.
@end deftypefun
@deftypefun {const char *} lt_dlerror (void)
Return a human readable string describing the most
recent error that occurred from any of libltdl's functions.
Return NULL if no errors have occurred since initialization
Return @code{NULL} if no errors have occurred since initialization
or since it was last called.
@end deftypefun
@deftypefun int lt_dlpreload (const lt_dlsymlist *@var{preloaded})
Register the list of preloaded modules @var{preloaded}.
If @var{preloaded} is NULL, then all previously registered
If @var{preloaded} is @code{NULL}, then all previously registered
symbol lists, except the list set by @code{lt_dlpreload_default},
are deleted. Return 0 on success.
@end deftypefun
@ -2975,6 +2985,22 @@ directories. Return 0 on success.
Return the current user-defined library search path.
@end deftypefun
@deftypefun int lt_dlsetdata (lt_dlhandle @var{handle}, lt_ptr_t @var{data})
Set the application private data for the module @var{handle} to @var{data}.
Return 0 on success.
@end deftypefun
@deftypefun lt_ptr_t lt_dlgetdata (lt_dlhandle @var{handle})
Return the application private data for the module @var{handle}.
If the handle @var{handle} is invalid or no data was set, it returns @code{NULL}.
@end deftypefun
@deftypefun {const lt_dlinfo *} lt_dlgetinfo (lt_dlhandle @var{handle})
Return a pointer to a struct that contains some information about
the module @var{handle}. The contents of the struct must not be modified.
Return @code{NULL} on failure.
@end deftypefun
@deftypevar {lt_ptr_t (*} lt_dlmalloc ) (size_t size)
@deftypevarx {void (*} lt_dlfree ) (lt_ptr_t ptr)
These variables are set to @code{malloc} and @code{free}, by default,

View File

@ -14,7 +14,7 @@ noinst_LTLIBRARIES = libltdlc.la
endif
libltdl_la_SOURCES = ltdl.c
libltdl_la_LDFLAGS = -no-undefined -version-info 1:2:1
libltdl_la_LDFLAGS = -no-undefined -version-info 2:1:2
libltdl_la_LIBADD = $(LIBADD_DL)
libltdlc_la_SOURCES = ltdl.c

View File

@ -21,7 +21,7 @@ if test -z "$enable_ltdl_install$enable_ltdl_convenience"; then
fi
fi
AM_INIT_AUTOMAKE(libltdl,1.0,-)
AM_INIT_AUTOMAKE(libltdl,1.1,-)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

View File

@ -1,5 +1,5 @@
/* ltdl.c -- system independent dlopen wrapper
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
@ -129,13 +129,12 @@ typedef struct lt_dltype_t {
typedef struct lt_dlhandle_t {
struct lt_dlhandle_t *next;
lt_dltype_t *type; /* dlopening interface */
char *filename; /* file name */
char *name; /* module name */
int usage; /* usage */
lt_dlinfo info;
int depcount; /* number of dependencies */
lt_dlhandle *deplibs; /* dependencies */
lt_ptr_t handle; /* system handle */
lt_ptr_t system; /* system specific data */
lt_ptr_t app_private; /* application private data */
} lt_dlhandle_t;
#undef strdup
@ -923,36 +922,37 @@ tryall_dlopen (handle, filename)
/* check whether the module was already opened */
cur = handles;
while (cur) {
if (!cur->filename && !filename)
/* try to dlopen the program itself? */
if (!cur->info.filename && !filename)
break;
if (cur->filename && filename &&
strcmp(cur->filename, filename) == 0)
if (cur->info.filename && filename &&
strcmp(cur->info.filename, filename) == 0)
break;
cur = cur->next;
}
if (cur) {
cur->usage++;
cur->info.ref_count++;
*handle = cur;
return 0;
}
cur = *handle;
if (filename) {
cur->filename = strdup(filename);
if (!cur->filename) {
cur->info.filename = strdup(filename);
if (!cur->info.filename) {
last_error = memory_error;
return 1;
}
} else
cur->filename = 0;
cur->info.filename = 0;
while (type) {
if (type->lib_open(cur, filename) == 0)
break;
type = type->next;
}
if (!type) {
if (cur->filename)
lt_dlfree(cur->filename);
if (cur->info.filename)
lt_dlfree(cur->info.filename);
return 1;
}
cur->type = type;
@ -987,9 +987,9 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
return 1;
}
sprintf (filename, "%s/%s", libdir, dlname);
error = tryall_dlopen(handle, filename) == 0;
error = tryall_dlopen(handle, filename) != 0;
lt_dlfree(filename);
if (error)
if (!error)
return 0;
}
/* try to open the not-installed module */
@ -1008,12 +1008,12 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
strcat(filename, objdir);
strcat(filename, dlname);
error = tryall_dlopen(handle, filename) == 0;
error = tryall_dlopen(handle, filename) != 0;
lt_dlfree(filename);
if (error)
if (!error)
return 0;
}
/* hmm, maybe it was moved to another directory */
/* maybe it was moved to another directory */
{
filename = (char*)
lt_dlmalloc((dir ? strlen(dir) : 0)
@ -1023,9 +1023,9 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
else
*filename = 0;
strcat(filename, dlname);
error = tryall_dlopen(handle, filename) == 0;
error = tryall_dlopen(handle, filename) != 0;
lt_dlfree(filename);
if (error)
if (!error)
return 0;
}
}
@ -1212,7 +1212,7 @@ lt_dlopen (filename)
lt_dlhandle handle = 0, newhandle;
const char *ext;
const char *saved_error = last_error;
char *basename = 0, *dir = 0, *name = 0;
char *canonical = 0, *basename = 0, *dir = 0, *name = 0;
if (!filename) {
handle = (lt_dlhandle) lt_dlmalloc(sizeof(lt_dlhandle_t));
@ -1220,7 +1220,7 @@ lt_dlopen (filename)
last_error = memory_error;
return 0;
}
handle->usage = 0;
handle->info.ref_count = 0;
handle->depcount = 0;
handle->deplibs = 0;
newhandle = handle;
@ -1230,28 +1230,26 @@ lt_dlopen (filename)
}
goto register_handle;
}
{
char *canonical = canonicalize_path (filename);
if (!canonical) {
last_error = memory_error;
if (handle)
lt_dlfree(handle);
return 0;
}
basename = strrchr(canonical, '/');
if (basename) {
basename++;
dir = (char*) lt_dlmalloc(basename - canonical + 1);
if (!dir) {
last_error = memory_error;
handle = 0;
goto cleanup;
}
strncpy(dir, canonical, basename - canonical);
dir[basename - canonical] = '\0';
} else
basename = canonical;
canonical = canonicalize_path (filename);
if (!canonical) {
last_error = memory_error;
if (handle)
lt_dlfree(handle);
return 0;
}
basename = strrchr(canonical, '/');
if (basename) {
basename++;
dir = (char*) lt_dlmalloc(basename - canonical + 1);
if (!dir) {
last_error = memory_error;
handle = 0;
goto cleanup;
}
strncpy(dir, canonical, basename - canonical);
dir[basename - canonical] = '\0';
} else
basename = canonical;
/* check whether we open a libtool module (.la extension) */
ext = strrchr(basename, '.');
if (ext && strcmp(ext, ".la") == 0) {
@ -1367,7 +1365,7 @@ lt_dlopen (filename)
/* handle is already set to 0 */
goto cleanup;
}
handle->usage = 0;
handle->info.ref_count = 0;
if (load_deplibs(handle, deplibs) == 0) {
newhandle = handle;
/* find_module may replace newhandle */
@ -1378,15 +1376,14 @@ lt_dlopen (filename)
}
} else
error = 1;
free_vars(dlname, old_name, libdir, deplibs);
if (error) {
lt_dlfree(handle);
handle = 0;
free_vars(dlname, old_name, libdir, deplibs);
goto cleanup;
}
if (handle != newhandle) {
if (handle != newhandle)
unload_deplibs(handle);
}
} else {
/* not a libtool module */
handle = (lt_dlhandle) lt_dlmalloc(sizeof(lt_dlhandle_t));
@ -1395,7 +1392,7 @@ lt_dlopen (filename)
/* handle is already set to 0 */
goto cleanup;
}
handle->usage = 0;
handle->info.ref_count = 0;
/* non-libtool modules don't have dependencies */
handle->depcount = 0;
handle->deplibs = 0;
@ -1423,9 +1420,10 @@ register_handle:
lt_dlfree(handle);
handle = newhandle;
}
if (!handle->usage) {
handle->usage = 1;
handle->name = name;
if (!handle->info.ref_count) {
handle->info.ref_count = 1;
handle->app_private = 0;
handle->info.name = name;
handle->next = handles;
handles = handle;
name = 0; /* don't free this during `cleanup' */
@ -1436,6 +1434,8 @@ cleanup:
lt_dlfree(dir);
if (name)
lt_dlfree(name);
if (canonical)
lt_dlfree(canonical);
return handle;
}
@ -1514,8 +1514,8 @@ lt_dlclose (handle)
last_error = invalid_handle_error;
return 1;
}
handle->usage--;
if (!handle->usage) {
handle->info.ref_count--;
if (!handle->info.ref_count) {
int error;
if (handle != handles)
@ -1524,10 +1524,10 @@ lt_dlclose (handle)
handles = handle->next;
error = handle->type->lib_close(handle);
error += unload_deplibs(handle);
if (handle->filename)
lt_dlfree(handle->filename);
if (handle->name)
lt_dlfree(handle->name);
if (handle->info.filename)
lt_dlfree(handle->info.filename);
if (handle->info.name)
lt_dlfree(handle->info.name);
lt_dlfree(handle);
return error;
}
@ -1555,8 +1555,8 @@ lt_dlsym (handle, symbol)
lensym = strlen(symbol);
if (handle->type->sym_prefix)
lensym += strlen(handle->type->sym_prefix);
if (handle->name)
lensym += strlen(handle->name);
if (handle->info.name)
lensym += strlen(handle->info.name);
if (lensym + LTDL_SYMBOL_OVERHEAD < LTDL_SYMBOL_LENGTH)
sym = lsym;
else
@ -1565,15 +1565,15 @@ lt_dlsym (handle, symbol)
last_error = buffer_overflow_error;
return 0;
}
if (handle->name) {
if (handle->info.name) {
const char *saved_error = last_error;
/* this is a libtool module */
if (handle->type->sym_prefix) {
strcpy(sym, handle->type->sym_prefix);
strcat(sym, handle->name);
strcat(sym, handle->info.name);
} else
strcpy(sym, handle->name);
strcpy(sym, handle->info.name);
strcat(sym, "_LTX_");
strcat(sym, symbol);
/* try "modulename_LTX_symbol" */
@ -1654,3 +1654,38 @@ lt_dlgetsearchpath LTDL_PARAMS((void))
{
return user_search_path;
}
int
lt_dlsetdata (handle, data)
lt_dlhandle handle;
lt_ptr_t data;
{
if (!handle) {
last_error = invalid_handle_error;
return 1;
}
handle->app_private = data;
return 0;
}
lt_ptr_t
lt_dlgetdata (handle)
lt_dlhandle handle;
{
if (!handle) {
last_error = invalid_handle_error;
return 0;
}
return handle->app_private;
}
const lt_dlinfo *
lt_dlgetinfo (handle)
lt_dlhandle handle;
{
if (!handle) {
last_error = invalid_handle_error;
return 0;
}
return &(handle->info);
}

View File

@ -1,5 +1,5 @@
/* ltdl.h -- generic dlopen functions
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
@ -107,6 +107,12 @@ typedef struct {
lt_ptr_t address;
} lt_dlsymlist;
typedef struct {
char *filename; /* file name */
char *name; /* module name */
int ref_count; /* reference count */
} lt_dlinfo;
__BEGIN_DECLS
extern int lt_dlinit LTDL_PARAMS((void));
extern int lt_dlpreload LTDL_PARAMS((const lt_dlsymlist *preloaded));
@ -120,6 +126,9 @@ extern const char *lt_dlerror LTDL_PARAMS((void));
extern int lt_dladdsearchdir LTDL_PARAMS((const char *search_dir));
extern int lt_dlsetsearchpath LTDL_PARAMS((const char *search_path));
extern const char *lt_dlgetsearchpath LTDL_PARAMS((void));
extern int lt_dlsetdata LTDL_PARAMS((lt_dlhandle handle, lt_ptr_t data));
extern lt_ptr_t lt_dlgetdata LTDL_PARAMS((lt_dlhandle handle));
extern const lt_dlinfo *lt_dlgetinfo LTDL_PARAMS((lt_dlhandle handle));
LTDL_SCOPE const lt_dlsymlist lt_preloaded_symbols[];
#define LTDL_SET_PRELOADED_SYMBOLS() lt_dlpreload_default(lt_preloaded_symbols)

2
libtool.m4 vendored
View File

@ -1,5 +1,5 @@
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
## Copyright (C) 1996-2000 Free Software Foundation, Inc.
## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
##
## This program is free software; you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#! /bin/sh
# libtoolize - Prepare a package to use libtool.
# @configure_input@
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
# Copyright (C) 1996-2000 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This program is free software; you can redistribute it and/or modify

2
lineno
View File

@ -2,7 +2,7 @@
# lineno - Replace instances of @LINENO@ with the file's current line number
# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1997
# Copyright (C) 1992-1999 Free Software Foundation, Inc.
# Copyright (C) 1992-2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#! /bin/sh
# ltconfig - Create a system-specific libtool.
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
# Copyright (C) 1996-2000 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; you can redistribute it and/or modify it
@ -492,16 +492,16 @@ else
ac_tool_prefix=
fi
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case "$host_os" in
linux-gnu*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
case "$host_os" in
aix3*)
# AIX sometimes has problems with the GCC collect2 program. For some
@ -1587,6 +1587,7 @@ gnu*)
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
hardcode_into_libs=yes
;;
hpux9* | hpux10* | hpux11*)
@ -1647,7 +1648,7 @@ linux-gnu*)
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
# before this can be enabled.
# hardcode_into_libs=yes
hardcode_into_libs=yes
if test -f /lib/ld.so.1; then
dynamic_linker='GNU ld.so'
@ -1718,6 +1719,7 @@ solaris*)
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
# ldd complains unless libraries are executable
postinstall_cmds='chmod +x $lib'
;;
@ -1990,7 +1992,7 @@ test "$enable_shared" = yes || enable_static=yes
echo "checking whether to build static libraries... $enable_static" 1>&6
if test "$hardcode_action" = relink || test "$hardcode_into_libs" = yes; then
if test "$hardcode_action" = relink || test "$hardcode_into_libs" = all; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
@ -2516,7 +2518,7 @@ case "$ltmain" in
# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
#
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
# Copyright (C) 1996-2000 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This program is free software; you can redistribute it and/or modify
@ -2872,7 +2874,7 @@ EOF
# on Windows for dlls which lack them. Don't remove nor modify the
# starting and closing comments
# /* impgen.c starts here */
# /* Copyright (C) 1999 Free Software Foundation, Inc.
# /* Copyright (C) 1999-2000 Free Software Foundation, Inc.
#
# This file is part of GNU libtool.
#

View File

@ -1,5 +1,5 @@
## libltdl.m4 - Configure ltdl for the target system. -*-Shell-script-*-
## Copyright (C) 1999 Free Software Foundation, Inc.
## ltdl.m4 - Configure ltdl for the target system. -*-Shell-script-*-
## Copyright (C) 1999-2000 Free Software Foundation, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* ltmain.c - C implementation of GNU Libtool
* Copyright (C) 1998-1999 Free Software Foundation, Inc.
* Copyright (C) 1998-2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
# ltmain.sh - Provide generalized library-building support services.
# NOTE: Changing this file will not affect anything until you rerun ltconfig.
#
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
# Copyright (C) 1996-2000 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This program is free software; you can redistribute it and/or modify
@ -694,8 +694,6 @@ compiler."
# libtool link mode
link | relink)
modename="$modename: link"
relink=no
test "$mode" = "relink" && relink=yes
case "$host" in
*-*-cygwin* | *-*-mingw* | *-*-os2*)
# It is impossible to link a dll without this setting, and
@ -1640,7 +1638,7 @@ compiler."
fi
fi
if test "$relink" = no; then
if test "$mode" != relink; then
# Remove our outputs.
$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
@ -1784,7 +1782,7 @@ compiler."
if test -n "$library_names" &&
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
# This is a shared library
if test "$hardcode_into_libs" = yes; then
if test "$hardcode_into_libs" = all; then
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
@ -1857,7 +1855,7 @@ compiler."
add_dir=
add_shlibpath=
add_name=no
if test "$relink" = no; then
if test "$mode" != relink; then
lib_linked=yes
case "$hardcode_action" in
immediate | unsupported)
@ -1952,7 +1950,9 @@ compiler."
fi
fi
if test -n "$dependency_libs"; then
if test -n "$dependency_libs" &&
{ test "$hardcode_into_libs" = no || test $build_old_libs = yes ||
test $link_static = yes; }; then
# Extract -R from dependency_libs
temp_deplibs=
for libdir in $dependency_libs; do
@ -2039,16 +2039,14 @@ compiler."
temp_xrpath=
for libdir in $xrpath; do
temp_xrpath="$temp_xrpath -R$libdir"
case "$compile_rpath " in
*" $libdir "*) ;;
*) compile_rpath="$compile_rpath $libdir" ;;
esac
case "$finalize_rpath " in
*" $libdir "*) ;;
*) finalize_rpath="$finalize_rpath $libdir" ;;
esac
done
dependency_libs="$temp_xrpath $dependency_libs"
if test "$hardcode_into_libs" = no || test $build_old_libs = yes; then
dependency_libs="$temp_xrpath $dependency_libs"
fi
fi
# Restore the variables
@ -2278,12 +2276,12 @@ EOF
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
if test "$hardcode_into_libs" = yes; then
if test "$hardcode_into_libs" != no; then
# Hardcode the library paths
hardcode_libdirs=
dep_rpath=
rpath="$finalize_rpath"
test "$relink" = no && rpath="$compile_rpath$rpath"
test "$mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
@ -2328,7 +2326,7 @@ EOF
fi
shlibpath="$finalize_shlibpath"
test "$relink" = no && shlibpath="$compile_shlibpath$shlibpath"
test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
if test -n "$shlibpath"; then
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
fi
@ -2444,7 +2442,7 @@ EOF
fi
# Make a backup of the uninstalled library when relinking
if test "$relink" = yes && test "$hardcode_into_libs" = yes ; then
if test "$mode" = relink && test "$hardcode_into_libs" = all; then
$run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
fi
@ -2463,7 +2461,7 @@ EOF
IFS="$save_ifs"
# Restore the uninstalled library and exit
if test "$relink" = yes && test "$hardcode_into_libs" = yes; then
if test "$mode" = relink && test "$hardcode_into_libs" = all; then
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
exit 0
fi
@ -2762,15 +2760,7 @@ EOF
fi
done
done
# Eliminate all dependency_libs that are already contained in deplibs
dependency_libs=
for deplib in $newdependency_libs; do
case "$deplibs " in
*" $deplib "*) ;;
*) dependency_libs="$dependency_libs $deplib" ;;
esac
done
dependency_libs="$newdependency_libs"
# Make sure lib_search_path contains only unique directories.
lib_search_path=
@ -2899,7 +2889,7 @@ EOF
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
hardcode=yes
test "$hardcode_into_libs" = yes && test "$alldeplibs" = yes && hardcode=no
test "$hardcode_into_libs" = all && test "$alldeplibs" = yes && hardcode=no
if test "$hardcode" = yes && test -n "$library_names" &&
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
# We need to hardcode the library path
@ -3113,10 +3103,6 @@ EOF
# If the user specified any rpath flags, then add them.
for libdir in $rpath $xrpath; do
# This is the magic to use -rpath.
case "$compile_rpath " in
*" $libdir "*) ;;
*) compile_rpath="$compile_rpath $libdir" ;;
esac
case "$finalize_rpath " in
*" $libdir "*) ;;
*) finalize_rpath="$finalize_rpath $libdir" ;;
@ -3475,7 +3461,7 @@ static const void *lt_preloaded_setup() {
exit 0
fi
if test "$hardcode_action" = relink || test "$hardcode_into_libs" = yes; then
if test "$hardcode_action" = relink || test "$hardcode_into_libs" = all; then
# Fast installation is not supported
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
@ -4082,7 +4068,7 @@ relink_command=\"$relink_command\""
test "X$dir" = "X$file/" && dir=
dir="$dir$objdir"
if test "$hardcode_into_libs" = yes; then
if test "$hardcode_into_libs" = all; then
if test -z "$relink_command"; then
$echo "$modename: invalid libtool pseudo library \`$file'" 1>&2
exit 1
@ -4104,7 +4090,7 @@ relink_command=\"$relink_command\""
shift
srcname="$realname"
test "$hardcode_into_libs" = yes && srcname="$realname"T
test "$hardcode_into_libs" = all && srcname="$realname"T
# Install the shared library and build the symlinks.
$show "$install_prog $dir/$srcname $destdir/$realname"

View File

@ -1,5 +1,5 @@
/* foo.h -- interface to the libfoo* libraries
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.

View File

@ -1,5 +1,5 @@
/* foo1.c -- trivial test library
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.

View File

@ -1,5 +1,5 @@
/* foo2.c -- trivial test library
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.

View File

@ -1,5 +1,5 @@
/* main.c -- mdemo test program
Copyright (C) 1998-1999 Free Software Foundation, Inc.
Copyright (C) 1998-2000 Free Software Foundation, Inc.
Originally by Thomas Tanner <tanner@ffii.org>
This file is part of GNU Libtool.
@ -27,6 +27,7 @@ test_dl (filename)
char *filename;
{
lt_dlhandle handle;
const lt_dlinfo *info;
int (*pfoo1)() = 0;
int (*pfoo2)() = 0;
int (*phello)() = 0;
@ -39,11 +40,21 @@ test_dl (filename)
fprintf (stderr, "error was: %s\n", lt_dlerror());
return 1;
}
phello = (int(*)())lt_dlsym(handle, "hello");
pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
pnothing = (int*)lt_dlsym(handle, "nothing");
info = lt_dlgetinfo(handle);
if (!info) {
fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
return 1;
}
if (info->name) {
printf ("module name: %s\n", info->name);
} else {
printf ("module is not a libtool module\n");
}
printf ("module filename: %s\n", info->filename);
printf ("module reference count: %i\n", info->ref_count);
phello = (int(*)())lt_dlsym(handle, "hello");
if (phello)
{
int value = (*phello) ();
@ -55,18 +66,22 @@ test_dl (filename)
else
{
fprintf (stderr, "did not find the `hello' function\n");
fprintf (stderr, "error was: %s\n", lt_dlerror());
ret = 1;
}
pnothing = (int*)lt_dlsym(handle, "nothing");
/* Try assigning to the nothing variable. */
if (pnothing)
*pnothing = 1;
else
{
fprintf (stderr, "did not find the `nothing' variable\n");
fprintf (stderr, "error was: %s\n", lt_dlerror());
ret = 1;
}
pfoo1 = (int(*)())lt_dlsym(handle, "foo1");
/* Just call the functions and check return values. */
if (pfoo1)
{
@ -75,18 +90,21 @@ test_dl (filename)
else
ret = 1;
}
else if (pfoo2)
{
if ((*pfoo2) () == FOO_RET)
printf("foo2 is ok!\n");
else ret = 1;
}
else
{
fprintf (stderr, "did not find the `foo' function\n");
ret = 1;
}
else {
pfoo2 = (int(*)())lt_dlsym(handle, "foo2");
if (pfoo2)
{
if ((*pfoo2) () == FOO_RET)
printf("foo2 is ok!\n");
else ret = 1;
}
else
{
fprintf (stderr, "did not find any of the `foo' functions\n");
fprintf (stderr, "error was: %s\n", lt_dlerror());
ret = 1;
}
}
lt_dlclose(handle);
return ret;
}
@ -113,9 +131,8 @@ test_dlself ()
fprintf (stderr, "error was: %s\n", lt_dlerror());
return 1;
}
pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");
pmyvar = (int*)lt_dlsym(handle, "myvar");
pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");
if (pmyfunc)
{
int value = (*pmyfunc) ();
@ -127,15 +144,18 @@ test_dlself ()
else
{
fprintf (stderr, "did not find the `myfunc' function\n");
fprintf (stderr, "error was: %s\n", lt_dlerror());
ret = 1;
}
pmyvar = (int*)lt_dlsym(handle, "myvar");
/* Try assigning to the variable. */
if (pmyvar)
*pmyvar = 1;
else
{
fprintf (stderr, "did not find the `myvar' variable\n");
fprintf (stderr, "error was: %s\n", lt_dlerror());
ret = 1;
}

View File

@ -1,7 +1,7 @@
#! /bin/sh
# mkstamp - extract data from Revision and Date RCS tags in a file
# Copyright (C) 1999 Free Software Foundation, Inc.
# Copyright (C) 1999-2000 Free Software Foundation, Inc.
# Alexandre Oliva <oliva@dcc.unicamp.br>
#
# This file is free software; you can redistribute it and/or modify it

View File

@ -100,7 +100,7 @@ else
fi
if test "x$hardcode_action" = xrelink ||
test "x$hardcode_into_libs" = xyes; then
test "x$hardcode_into_libs" = xall; then
echo "= Exiting: install-time relinking is required"
exit 0
fi

View File

@ -100,7 +100,7 @@ else
fi
if test "x$hardcode_action" = xrelink ||
test "x$hardcode_into_libs" = xyes; then
test "x$hardcode_into_libs" = xall; then
echo "= Exiting: install-time relinking is required"
exit 0
fi