+1999-01-17 Thomas Tanner <tanner@gmx.de>
+
+ * Makefile.am: added libltdl.tar.gz to CLEANFILES
+ * ChangeLog: some reformatting
+ * TODO: documentation updates
+ * doc/libtool.texi: added preliminary libltdl documentation,
+ updated dlopen and -module documentation,
+ renamed -avoid-versioning to -avoid-version
+ documented the libtool script variables compiler_c_o,
+ compiler_o_lo, need_locks, old_postuninstall_cmds,
+ postuninstall_cmds, sys_lib_search_path_spec,
+ fix_srcfile_path, objdir, objext, libext,
+ documented the two new flags (--ltdl[-tar]) of libtoolize
+ * libltdl/Makefile.am: incremented the version, removed
+ libtool dependency so that it can be build independently
+ * libltdl/configure.in: removed LTDL_SHLIB_EXT hack,
+ set version to 1.0, use AM_MAINTAINER_MODE,
+ DLPREOPEN is always supported, check for libtool's objdir variable
+ (LTDL_OBJDIR)
+ * libltdl/ltdl.c: some cleanups (moved constants to the beginning
+ of the file and prefixed all of them with LTDL_, minor optimizations
+ in find_file() and find_module()), renamed lt_dlpreopen* to
+ lt_dlpreload* for consistency, removed LTDL_SHLIB_EXT hack,
+ we don't need unistd.h, DLPREOPEN is _always_ supported,
+ reverted Alexandre's lt_dlpreopen_default_ change,
+ try to open the not-installed module before the installed one,
+ replaced lt_dlsearchpath() with lt_dladdsearchdir(),
+ lt_dlsetsearchpath() and lt_dlgetsearchpath()
+ * libltdl/ltdl.h: renamed lt_dlpreopen* to lt_dlpreload*
+ for consistency, removed the declaration of lt_preloaded_symbols
+ (should be imported by programs),
+ reverted Alexandre's lt_dlpreopen_default_ change and added
+ two new macros LTDL_PRELOADED_SYMBOLS and
+ LTDL_SET_PRELOADED_SYMBOLS(),
+ added lt_dladdsearchdir(), lt_dlsetsearchpath() and
+ lt_dlgetsearchpath()
+ * libtool.m4: some reformatting
+ * libtoolize.in: implemented --ltdl, bugfix when checking for
+ the libtool package directory
+ * ltconfig.in: removed $thread_safe_flags from Andrey Slepuhin's
+ AIX patch, renamed sys_lib_search_path to sys_lib_search_path_spec,
+ some reformatting, fixed typo in deplibs_check_method (unkwnon)
+ * ltmain.in: documented -o for compile mode, some reformatting,
+ renamed -avoid-versioning to -avoid-version
+ renamed sys_lib_search_path to sys_lib_search_path_spec
+ * mdemo/Makefile.am: use -avoid-version
+ * mdemo/main.c: use LTDL_PRELOADED_SYMBOLS and
+ LTDL_SET_PRELOADED_SYMBOLS()
+
1999-01-17 Alexandre Oliva <oliva@dcc.unicamp.br>
* ltconfig.in (wlarc): set to either '${wl}' or an empty string,
1999-01-14 Alexandre Oliva <oliva@dcc.unicamp.br>
* Makefile.am: Moved ltconfig and ltmain.sh back into srcdir, and
- add them to the distribution. Added work-around if `mv -f' fails.
+ add them to the distribution. Added work-around if `mv -f' fails.
fix @AINCLUDE_M4_LIST@ and @DIST_MAKEFILE_LIST@ for relative and
absolute specifications of srcdir
install only the necessary libtool scripts, not just all
files in pkgdatadir
* mdemo/Makefile.am: removed the rule for libltdl configuration
-
+
1999-01-13 Alexandre Oliva <oliva@dcc.unicamp.br>
* mdemo/Makefile.am (../libltdl/libtool): mkdir and configure
libtool.m4, in last Alexandre Oliva's change to it
(sysv4*, ncr): pass all library dependencies
* ltmain.in (dependency_libs, -R): use `deplib' instead of `arg' to
- iterate, otherwise we'd overwrite `arg'
+ iterate, otherwise we'd overwrite `arg'
(convenience, old_libs): if --disable-shared, convenience
libraries are just old archives, as .lo's are of no use
* tests/cdemo-static.test: print --disable-shared here
* Makefile.am (@DIST_MAKEFILE_LIST@): `$' must be doubled
* configure.in (AC_CONFIG_DIRS): configure only libltdl, and then,
- only if --enable-ltdl-install
+ only if --enable-ltdl-install
(CONF_SUBDIRS): list directories that are configured on demand,
but that must be included in the distribution
(ACINCLUDE_M4_LIST, DIST_MAKEFILE_LIST): generated from CONF_SUBDIRS
documented that -rpath is not required for convenience libraries
* ltconfig.in (symxfrm): don't print $pipe_works twice, once for
- each $ac_symprfx
+ each $ac_symprfx
Reported by Godmar Back <gback@cs.utah.edu>
* ltmain.in (convenience, libobjs): get only .o and .lo files from
file, and therefore should not be fed to the linker
* libtool.m4 (AM_SYS_NM_PARSE): while we are at it, we may well
- cache the value of ac_cv_sys_symbol_underscore
+ cache the value of ac_cv_sys_symbol_underscore
* libtool.m4 (AM_SYS_NM_PARSE): need for underscore prefix is now
- auto-detected, by trying first without, then with it.
+ auto-detected, by trying first without, then with it.
* ltconfig.in: ditto
most systems
(LT_SYMBOL_LENGTH): renamed from MAX_SYMBOL_LENGTH
(LT_SYMBOL_OVERHEAD): new macro, that accounts for the size of
- the _LTX_ separator and the initial underscore
+ the _LTX_ separator and the initial underscore
(lt_dlsym): sym now points to a stack buffer (lsym) if possible,
or is dynamically allocated. If allocation fails, a
buffer_overflow_error is returned.
1999-01-05 Alexandre Oliva <oliva@dcc.unicamp.br>
* ltmain.in (libobjs_save, oldobjs): when building an
- old-fashioned archive, use a copy of libobjs saved before
- convenience libraries are appended
+ old-fashioned archive, use a copy of libobjs saved before
+ convenience libraries are appended
* libltdl/ltdl.h (_LTDLL_EXPORT, _LTDLL_IMPORT): use cygwin or
unix library import/export primitives; this may be convenient for
(_LTDLL_EXTERN): select _LTDLL_EXPORT or _LTDLL_IMPORT depending
on _LTDL_COMPILE_
* libltdl/ltdl.h, libltdl/ltdl.c (lt_dlpreopen): new function,
- that replaces the current preloaded_symbols list with its
- argument, and returns the old value, initially NULL
+ that replaces the current preloaded_symbols list with its
+ argument, and returns the old value, initially NULL
(dldpre_init): don't refer to dld_preloaded_symbols any more
(dldpre_open, dldpre_sym): search preloaded_symbols
(lt_dlpreopen_default): call lt_dlpreopen with
would lose for files with embedded blanks.
* ltconfig.in (cygwin, archive_cmds, archive_sym_cmds): Moved
- ltdll.c into ltmain.in, to avoid its duplication, and added a sed
- script to extract it. Also, create def and base files in $objdir,
- and don't remove them after the compilation.
+ ltdll.c into ltmain.in, to avoid its duplication, and added a sed
+ script to extract it. Also, create def and base files in $objdir,
+ and don't remove them after the compilation.
(cygwin, library_names_spec): Create static part of the dll with
- suffix -dll.a, to avoid conflicts with actual static libraries.
+ suffix -dll.a, to avoid conflicts with actual static libraries.
* ltmain.in: Added ltdll.c, as commented out text
1999-01-01 Thomas Tanner <tanner@gmx.de>
longer distributed.
* tests/assign.test, if.test, test-e.test: Even though 15 tests looks
- impressive, these are now redundant. Remove them from the
- distribution.
+ impressive, these are now redundant. Remove them from the
+ distribution.
* tests/sh.test: Do what assign.test, if.test, and test-e.test used to
- do.
+ do.
1998-02-16 Gordon Matzigkeit <gord@profitpress.com>
Stephan Kulow.
* tests/defs: Correctly identify absolute directory names on MS-DOS.
- Suggested by Bob Friesenhahn.
+ Suggested by Bob Friesenhahn.
1998-02-11 Gordon Matzigkeit <gord@profitpress.com>
specified.
* tests/nomode.test: New test to make sure there is correct behaviour
- when we don't specify a mode.
+ when we don't specify a mode.
1997-07-08 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
need to link against another library.
* tests/hardcode.test: Rewrite to use fgrep on output from ``strings
- -a'' if using fgrep directly on the binary files fails. From Mark
- Kettenis.
+ -a'' if using fgrep directly on the binary files fails. From Mark
+ Kettenis.
1997-01-28 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
Haible.
* tests/demo-conf.test: Use the CONFIG_SHELL environment variable when
- running configure in the demo directory. From Bruno Haible.
+ running configure in the demo directory. From Bruno Haible.
* tests/Makefile.am (clean-local): Make distclean in the demo directory,
so that ``make clean; env CC=cc make check'' works as one would
expect.
* tests/demo-make.test: Fix typo (use $make instead of make). Reported
- by Akim Demaille.
+ by Akim Demaille.
1997-01-17 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* tests/demo-conf.test, tests/demo-inst.test, tests/demo-unst.test,
tests/hardcode.test:
- Use $make instead of make.
+ Use $make instead of make.
* tests/defs (make): Add definition of $make that uses the $MAKE
environment variable, if set. Suggested by Bruno Haible.
line.
* tests/demo-unst.test: Don't fail if make uninstall doesn't delete
- files beginning with a dot, since spurious .nfsXXX files may be
- present when running NFS. Reported by Bruno Haible.
+ files beginning with a dot, since spurious .nfsXXX files may be
+ present when running NFS. Reported by Bruno Haible.
1997-01-02 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
Fortran and C++.
* tests/suffix.test: New test to guarantee that libtool compile
- recognizes valid source file suffices.
+ recognizes valid source file suffices.
1996-12-17 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
EXTRA_DIST = $(aclocal_macros) libtoolize.in ltconfig.in ltmain.in \
libtool.spec
-CLEANFILES = libtool libtoolize ltconfig.T ltmain.shT
+CLEANFILES = libtool libtoolize ltconfig.T ltmain.shT libltdl.tar.gz
# These are required by libtoolize.
pkgdata_SCRIPTS = config.guess config.sub ltconfig
libltdl.tar.gz: libltdl/Makefile
(cd libltdl && $(MAKE) dist)
rm -f libltdl.tar.gz
- ln -s libltdl/libltdl-0.1.tar.gz libltdl.tar.gz
+ ln -s libltdl/libltdl-1.0.tar.gz libltdl.tar.gz
libtool: $(srcdir)/ltmain.sh $(srcdir)/ltconfig
CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
* Support -R for specifying run-time path of programs and library dependencies
* Support for BeOS
* Improved support for Win32, aix3, aix4, SysV 4.3, BSD/OS 4.x and NetBSD
+* New -avoid-version option to avoid versioning for libraries
* Various bugfixes
New in 1.2c: CVS version; 1.2d: 1998-12-16, Libtool team:
* Documentation:
-- libltdl needs to be documented
-
-- Some variables are still not documented in
- "libtool script contents", namely:
- compiler_c_o, compiler_o_lo, need_locks,
- old_postuninstall_cmds, postuninstall_cmds,
- old_archive_from_new_cmds, sys_lib_search_path,
- fix_srcfile_path, objdir, objext, libext
-
-- Some tests are only poorly documented:
- assign.test, quote.test, sh.test
+- libltdl documentation needs to be completed.
In the future:
**************
* Library tips:: Tips for library interface design.
* Inter-library dependencies:: Libraries that depend on other libraries.
* Dlopened modules:: @code{dlopen}ing libtool-created libraries.
+* Using libltdl:: Libtool's portable @code{dlopen} wrapper library.
* Other languages:: Using libtool without a C compiler.
* Troubleshooting:: When libtool doesn't work as advertised.
* Maintaining:: Information used by the libtool maintainer.
* Finding the dlname:: Choosing the right file to @code{dlopen}.
* Dlopen issues:: Unresolved problems that need your attention.
+Using libltdl
+
+* Libltdl's interface:: How to use libltdl in your programs.
+* Modules for libltdl:: Creating modules that can be @code{dlopen}ed.
+* Distributing libltdl:: How to distribute libltdl with your package.
+
Using libtool with other languages
* C++ libraries::
shared libraries at all. If @var{output-file} is a library, then only
create a static library.
-@item -avoid-versioning
+@item -avoid-version
Tries to avoid versioning (@pxref{Versioning}) for libraries and modules,
i.e. no version information is stored and no symbolic links are created.
If the platform requires versioning, this option has no effect.
Creates a library that can be dlopenend (@pxref{Dlopened modules}).
This option doesn't work for programs and must not be used
together with @samp{-export-symbols}.
-It implies the option @samp{-export-dynamic}.
+It enables the option @samp{-export-dynamic} automatically.
Module names don't need to be prefixed with 'lib'.
In order to prevent name clashes, however, 'libname' and 'name'
-must not be used at the same time.
+must not be used at the same time in your package.
@item -no-undefined
Declare that @var{output-file} does not depend on any other libraries.
@item --help
Display a help message and exit.
+@item --ltdl
+Install libltdl in a subdirectory of your package.
+
+@item --ltdl-tar
+Add the file libltdl.tar.gz to your package.
+
@item --version
Print @code{libtoolize} version information and exit.
@end table
language interpreters to provide an efficient way to extend the
language.
-As of version @value{VERSION}, libtool provides experimental support for
-dlopened modules, which does not radically simplify the development of
-dlopening applications. However, this support is designed to be a
-portable foundation for generic, higher-level dlopen functions.
+As of version @value{VERSION}, libtool provides support for
+dlopened modules.
-This chapter discusses the preliminary support that libtool offers, and
-how you as a dlopen application developer might use libtool to generate
-dlopen-accessible modules. It is important to remember that these are
-experimental features, and not to rely on them for easy answers to the
-problems associated with dlopened modules.
+This chapter discusses how you as a dlopen application developer might
+use libtool to generate dlopen-accessible modules.
@menu
* Building modules:: Creating dlopenable objects and libraries.
in order to be dynamically resolved with the @code{dlsym} (or
equivalent) function.
-Libtool provides the @samp{-export-dynamic} link
-flags (@pxref{Link mode}), which does this declaration.
-You need to use this flag if you are linking an application program that
+Libtool provides the @samp{-export-dynamic} and @samp{-module}
+link flags (@pxref{Link mode}), which do this declaration.
+You need to use these flags if you are linking an application program that
dlopens other modules or a libtool library that will also be dlopened.
For example, if we wanted to build a shared library, @file{libhello},
that would later be dlopened by an application, we would add
-@samp{-export-dynamic} to the other link flags:
+@samp{-module} to the other link flags:
@example
-burger$ @kbd{libtool gcc -export-dynamic -o libhello.la foo.lo \
+burger$ @kbd{libtool gcc -module -o libhello.la foo.lo \
hello.lo -rpath /usr/local/lib -lm}
burger$
@end example
-Another situation where you would use @samp{-export-dynamic} is if
-symbols from your @emph{executable} are needed to satisfy unresolved
-references in a library you want to dlopen. In this case, you should
-use @samp{-export-dynamic} while linking the executable that calls
+If symbols from your @emph{executable} are needed to satisfy unresolved
+references in a library you want to dlopen you will have to use the flag
+@samp{-export-dynamic}.
+You should use @samp{-export-dynamic} while linking the executable that calls
dlopen:
@example
without crashing.
@end enumerate
-Libtool emulates @samp{-export-dynamic}
+Libtool emulates @samp{-export-dynamic} and @samp{-dlopen}
on static platforms by linking objects into the program at compile time,
and creating data structures that represent the program's symbol table.
application to dlopen by using the @samp{-dlopen} or @samp{-dlpreopen}
flags when you link your program (@pxref{Link mode}).
-@deftypefn {Structure} {typedef struct}
-lt_symbol @{ @w{const char *@var{name};} @w{lt_ptr_t @var{address};} @}
-
-The @var{name} attribute is a zero-terminated character string of the
+@deftypefn {Structure} {struct} lt_dlsymlist @{ @w{const char *@var{name};} @w{lt_ptr_t @var{address};} @}
+The @var{name} attribute is a null-terminated character string of the
symbol name, such as @code{"fprintf"}. The @var{address} attribute is a
generic pointer to the appropriate object, such as @code{&fprintf}.
@end deftypefn
-@deftypevar {const lt_symbol *} lt_preloaded_symbols
+@deftypevar {const lt_dlsymlist *} lt_preloaded_symbols
An array of @var{lt_symbol} structures, representing all the preloaded
symbols linked into the program. For each @samp{-dlpreloaded} file
there is an element with the @var{name} of the file and a @var{address}
@item
Dlopen functions are generally only available on shared library
platforms. If you want your package to be portable to static platforms,
-you have to develop your own alternatives to dlopening dynamic code.
+you have to use either libltdl (@pxref{Using libltdl}) or develop your
+own alternatives to dlopening dynamic code.
Most reasonable solutions involve writing wrapper functions for the
@code{dlopen} family, which do package-specific tricks when dlopening
is unsupported or not available on a given platform.
to discover the correct module filename to supply to @code{dlopen}.
@end itemize
+Libtool provides a small library, called @file{libltdl}, that aims at
+hiding the various difficulties of dlopening libraries from programmers.
+
+@node Using libltdl
+@chapter Using libltdl
+@findex libltdl
+@findex dlopen
+@findex dlsym
+@findex dlclose
+@findex dlerror
+@findex shl_load
+@cindex dynamic linking, applications
+@cindex dlopening modules
+@cindex modules, dynamic
+@cindex application-level dynamic linking
+
Libtool provides a small library, called @file{libltdl}, that aims at
hiding the various difficulties of dlopening libraries from programmers.
It consists of a header-file and a small C source file that can be
-distributed with applications that need dlopening functionality. Note,
-however, that its experimental interface is not document and is subject
-to change; use it at your own risk. On some platforms, whose dynamic
-linkers are too limited for a simple implementation of @file{libltdl}
-services, it will require GNU DLD.
+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.
+
+@menu
+* Libltdl's interface:: How to use libltdl in your programs.
+* Modules for libltdl:: Creating modules that can be @code{dlopen}ed.
+* Distributing libltdl:: How to distribute libltdl with your package.
+@end menu
+
+@node Libltdl's interface
+@section How to use libltdl in your programs
+
+@noindent
+Libltdl's API is similar to the dlopen interface of Solaris and Linux,
+which is very simple but powerful.
+
+@noindent
+To use libltdl in your program you have include the header file @file{ltdl.h}:
+
+@example
+#include <ltdl.h>
+@end example
+
+@noindent
+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:
+
+@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.
+
+@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}.
+@end table
+
+@noindent
+Libltdl provides the following functions:
+
+@deftypefun int lt_dlinit (void)
+Initialize libltdl.
+This function must be called before using libltdl
+and may be called several times.
+Return 0 on success, otherwise the number of errors.
+@end deftypefun
+
+@deftypefun int lt_dlexit (void)
+Shut down libltdl and close all modules.
+This function will only then shut down libltdl when it was called as
+many times as @code{lt_dlinit} has been successfully called.
+Return 0 on success, otherwise the number of errors.
+@end deftypefun
+
+@deftypefun lt_dlhandle lt_dlopen (const char *@var{filename})
+Open the module with the file name @var{filename} and
+return a handle for it.
+The module can be either a libtool module
+(the file name has a ".la" extension and the module was linked
+using the @code{-module} flag) or a native dynamic library.
+
+Unresolved symbols in the module are resolved using its dependency
+libraries and previously dlopened modules.
+If the 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.
+Libltdl tries to resolve the symbols immediately and returns NULL
+if that fails.
+
+If libltdl cannot find the library and the file name @var{filename} does not
+have a directory component it will additionally search in the following
+search paths for the module (in the order as follows):
+
+@enumerate 1
+@item user-defined search path:
+This search path can be set by the program using the
+functions @code{lt_dlsetsearchpath} and @code{lt_dladdsearchdir}.
+
+@item libltdl's search path:
+This search path is the value of the environment variable
+@var{LTDL_LIBRARY_PATH}.
+
+@item system library search path:
+The system dependent library search path
+(e.g. on Linux it is @var{LD_LIBRARY_PATH}).
+@end enumerate
+
+Each search path must be a colon-separated list of absolute directories,
+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 int lt_dlclose (lt_dlhandle @var{handle})
+Decrement the reference count on the module @var{handle}.
+If it drops to zero and no other module depends on this module,
+then the module is unloaded.
+Return 0 on success.
+@end deftypefun
+
+@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.
+@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
+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
+symbol lists, except the list set by @code{lt_dlpreload_default},
+are deleted. Return 0 on success.
+@end deftypefun
+
+@deftypefun int lt_dlpreload_default (const lt_dlsymlist *@var{preloaded})
+Set the default list of preloaded modules to @var{preloaded},
+which won't be deleted by @code{lt_dlpreload}.
+Note that this function does *not* require libltdl to be initialized
+using @code{lt_dlinit} and can be used in the program to register
+the default preloaded modules.
+Usually the main function in the program will set libtool's default
+symbol list:
+
+@example
+extern const lt_dlsymlist lt_preloaded_symbols[];
+
+...
+
+lt_dlpreload_default(lt_preloaded_symbols);
+@end example
+
+Libltdl defines the macros @code{LTDL_PRELOADED_SYMBOLS} and
+@code{LTDL_SET_PRELOADED_SYMBOLS}, which hide these libtool dependent
+declaration for you.
+
+Return 0 on success.
+@end deftypefun
+
+@deftypefun int lt_dladdsearchdir (const char *@var{search_dir})
+Add the search directory @var{search_dir} to the user-defined library
+search path. Return 0 on success.
+@end deftypefun
+
+@deftypefun int lt_dlsetsearchpath (const char *@var{search_path})
+Replace the current user-defined library search path with
+@var{search_path}. Return 0 on success.
+@end deftypefun
+
+@deftypefun const char *lt_dlgetsearchpath (void)
+Return the current user-defined library search path.
+@end deftypefun
+
+@defmac LTDL_PRELOADED_SYMBOLS
+Import libtool's preloaded symbols.
+See @code{LTDL_SET_PRELOADED_SYMBOLS}.
+@end defmac
+
+@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.
+
+@example
+LTDL_PRELOADED_SYMBOLS;
+
+int main() @{
+...
+LTDL_SET_PRELOADED_SYMBOLS();
+...
+@}
+@end example
+@end defmac
+
+@node Modules for libltdl
+@section Creating modules that can be @code{dlopen}ed
+
+empty
+
+@node Distributing libltdl
+@section How to distribute libltdl with your package
+
+empty
@node Other languages
@chapter Using libtool with other languages
@samp{yes} or @samp{no}.
@end defvar
+@defvar compiler_c_o
+Whether the compiler supports the @code{-c} and @code{-o} options
+simultaneously. Set to @samp{yes} or @samp{no}.
+@end defvar
+
+@defvar compiler_o_lo
+Whether the compiler supports compiling directly to a ".lo" file,
+i.e whether object files do not have to have the suffix ".o".
+Set to @samp{yes} or @samp{no}.
+@end defvar
+
@defvar echo
An @code{echo} program which does not interpret backslashes as an
escape character.
Same as @var{finish_cmds}, except the commands are not displayed.
@end defvar
+@defvar fix_srcfile_path
+Expression to fix the shell variable $srcfile for the compiler.
+@end defvar
+
@defvar global_symbol_pipe
A pipeline that takes the output of @var{NM}, and produces a listing of
raw symbols followed by their C names. For example:
the system that libtool was configured for.
@end defvar
+@defvar libext
+The standard old archive suffix (normally "a").
+@end defvar
+
@defvar libname_spec
The format of a library name prefix. On all Unix systems, static
libraries are called @samp{lib@var{name}.a}, but on some systems (such
@end defvar
@defvar need_version
-Whether versioning is required for libraries.
+Whether versioning is required for libraries, i.e. whether the
+dynamic linker requires a version suffix for all libraries.
Set to @samp{yes} or @samp{no}. By default, it is @samp{unknown}, which
means the same as @samp{yes}, but documents that we are not really sure
about it.
@end defvar
+@defvar need_locks
+Whether files must be locked to prevent conflicts when compiling
+simultaneously. Set to @samp{yes} or @samp{no}.
+@end defvar
+
@defvar no_builtin_flag
Compiler flag to disable builtin functions that conflict with declaring
external global symbols as @code{char}.
Empty, if no such flag is required.
@end defvar
+@defvar objdir
+The name of the directory that contains temporary libtool files.
+@end defvar
+
+@defvar objext
+The standard object file suffix (normally "o").
+@end defvar
+
@defvar pic_flag
Any additional compiler flags for building library object files.
@end defvar
Commands run after installing a shared or static library, respectively.
@end defvar
+@defvar postuninstall_cmds
+@defvarx old_postuninstall_cmds
+Commands run after uninstalling a shared or static library, respectively.
+@end defvar
+
@defvar reload_cmds
@defvarx reload_flag
Commands to create a reloadable object.
the file.
@end defvar
+@defvar sys_lib_search_path_spec
+Expression to get the system library search path.
+@end defvar
+
@defvar version_type
The library version numbering type. One of @samp{libtool},
@samp{linux}, @samp{osf}, @samp{sunos}, or @samp{none}.
#
AUTOMAKE_OPTIONS = no-dependencies foreign
-LTDL_VERSION = -version-info 1:0:1
+LTDL_VERSION = -version-info 1:1:1
if INSTALL_LTDL
LTDL_FLAGS = $(LTDL_VERSION) -rpath $(libdir)
libltdl_la_SOURCES = ltdl.c
libltdl_la_LDFLAGS = $(LTDL_FLAGS)
libltdl_la_LIBADD = $(LIBADD_DL)
-libltdl_la_DEPENDENCIES = libtool
libltdlc_la_SOURCES = $(libltdl_la_SOURCES)
libltdlc_la_LDFLAGS =
libltdlc_la_LIBADD = $(libltdl_la_LIBADD)
-libltdlc_la_DEPENDENCIES = libtool
-
-libtool: ../libtool
- ./config.status --recheck
dnl Process this file with autoconf to create configure.
dnl Initialize the libltdl package.
AC_INIT(ltdl.c)
-AM_INIT_AUTOMAKE(libltdl,0.1)
+AM_INIT_AUTOMAKE(libltdl,1.0,-)
+
+AM_MAINTAINER_MODE
AC_ARG_ENABLE(ltdl-install,
[--enable-ltdl-install install libltdl])
AC_PROG_CC
AM_PROG_LIBTOOL
-AC_CACHE_CHECK([which extension is used for shared libraries],
- libltdl_cv_shlibext, [dnl
+AC_CACHE_CHECK([which variable specifies run-time library path],
+ libltdl_cv_shlibpath_var, [dnl
(
rm -f conftest
./libtool --config > conftest
. ./conftest
- last=
- for spec in $library_names_spec; do
- last="$spec"
- done
rm -f conftest
-changequote(, )
- echo "$last" | sed 's/^[^.]*//;s/\$.*$//;s/\.$//' > conftest
-changequote([, ])
+ echo "$shlibpath_var" > conftest
)
-libltdl_cv_shlibext=`cat conftest`
+libltdl_cv_shlibpath_var=`cat conftest`
rm -f conftest
])
-if test x"$libltdl_cv_shlibext" != x""; then
- AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext")
+if test -n "$libltdl_cv_shlibpath_var"; then
+ AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var")
fi
-AC_CACHE_CHECK([which variable specifies run-time library path],
- libltdl_cv_shlibpath_var, [dnl
+AC_CACHE_CHECK([for objdir],
+ libltdl_cv_objdir, [dnl
(
rm -f conftest
./libtool --config > conftest
. ./conftest
rm -f conftest
- echo "$shlibpath_var" > conftest
+ echo "$objdir" > conftest
)
-libltdl_cv_shlibpath_var=`cat conftest`
+libltdl_cv_objdir=`cat conftest`
rm -f conftest
])
-if test x"$libltdl_cv_shlibpath_var" != x""; then
- AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var")
-fi
+test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
+AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir")
AC_HEADER_STDC
-AC_CHECK_HEADERS(malloc.h memory.h stdlib.h unistd.h stdio.h ctype.h dlfcn.h dl.h)
+AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h)
AC_CHECK_HEADERS(string.h strings.h, break)
AC_CHECK_FUNCS(strdup strchr strrchr index rindex)
-AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
- libltdl_cv_dlpreopen, [dnl
- if grep '^global_symbol_pipe=..*$' ./libtool >/dev/null; then
- libltdl_cv_dlpreopen=yes
- else
- libltdl_cv_dlpreopen=no
- fi
-])
-if test x"$libltdl_cv_dlpreopen" = x"yes"; then
- AC_DEFINE(HAVE_DLPREOPEN)
-fi
-
-supported=yes
test_dlerror=no
LIBADD_DL=
AC_CHECK_FUNCS(dlopen, [AC_DEFINE(HAVE_LIBDL) test_dlerror=yes],
#include <stdlib.h>
#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#include "ltdl.h"
+/* max. filename length */
+#ifndef LTDL_FILENAME_MAX
+#define LTDL_FILENAME_MAX 1024
+#endif
+
+#ifndef LTDL_SEARCHPATH_MAX
+#define LTDL_SEARCHPATH_MAX 4096
+#endif
+
+#undef LTDL_READTEXT_MODE
+/* fopen() mode flags for reading a text file */
+#ifdef _WIN32
+#define LTDL_READTEXT_MODE "rt"
+#else
+#define LTDL_READTEXT_MODE "r"
+#endif
+
+#undef LTDL_SYMBOL_LENGTH
+/* This is the maximum symbol size that won't require malloc/free */
+#define LTDL_SYMBOL_LENGTH 256
+
+#undef LTDL_SYMBOL_OVERHEAD
+/* This accounts for the _LTX_ separator and the string terminator */
+#define LTDL_SYMBOL_OVERHEAD 6
+
+
static const char *unknown_error = "unknown error";
static const char *dlopen_not_supported_error = "dlopen support not available";
-static const char *dlpreopen_not_supported_error = "dlpreopen support not available";
static const char *file_not_found_error = "file not found";
static const char *no_symbols_error = "no symbols defined";
static const char *symbol_error = "symbol not found";
static const char *shutdown_error = "library already shutdown";
static const char *last_error = 0;
-static const char *usr_search_path = 0;
typedef struct lt_dltype_t {
struct lt_dltype_t *next;
lt_ptr_t (*find_sym) __P((lt_dlhandle handle, const char *symbol));
} lt_dltype_t, *lt_dltype;
-#define LT_DLTYPE_TOP 0
+#define LTDL_TYPE_TOP 0
typedef struct lt_dlhandle_t {
struct lt_dlhandle_t *next;
{
lt_ptr_t address = dlsym(handle->handle, symbol);
- if (!address)
+ if (!address)
last_error = dlerror();
return address;
}
static
lt_dltype_t
#ifdef NEED_USCORE
-dl = { LT_DLTYPE_TOP, "_", dl_init, dl_exit,
+dl = { LTDL_TYPE_TOP, "_", dl_init, dl_exit,
dl_open, dl_close, dl_sym };
#else
-dl = { LT_DLTYPE_TOP, 0, dl_init, dl_exit,
+dl = { LTDL_TYPE_TOP, 0, dl_init, dl_exit,
dl_open, dl_close, dl_sym };
#endif
-#undef LT_DLTYPE_TOP
-#define LT_DLTYPE_TOP &dl
+#undef LTDL_TYPE_TOP
+#define LTDL_TYPE_TOP &dl
#endif
#if HAVE_SHL_LOAD
-/* dynamic linking with shl_load (HP-UX) */
+/* dynamic linking with shl_load (HP-UX) (comments from gmodule) */
#ifdef HAVE_DL_H
#include <dl.h>
{
lt_ptr_t address;
- if (shl_findsym((shl_t) (handle->handle), symbol, TYPE_UNDEFINED,
+ if (shl_findsym((shl_t) (handle->handle), symbol, TYPE_UNDEFINED,
&address) != 0 || !(handle->handle) || !address) {
last_error = unknown_error;
return 0;
static
lt_dltype_t
-shl = { LT_DLTYPE_TOP, 0, shl_init, shl_exit,
+shl = { LTDL_TYPE_TOP, 0, shl_init, shl_exit,
shl_open, shl_close, shl_sym };
-#undef LT_DLTYPE_TOP
-#define LT_DLTYPE_TOP &shl
+#undef LTDL_TYPE_TOP
+#define LTDL_TYPE_TOP &shl
#endif
{
lt_ptr_t address = dld_get_func(symbol);
- if (!address)
+ if (!address)
last_error = unknown_error;
return address;
}
static
lt_dltype_t
-dld = { LT_DLTYPE_TOP, 0, dld_init, dld_exit,
+dld = { LTDL_TYPE_TOP, 0, dld_init, dld_exit,
dld_open, dld_close, dld_sym };
-#undef LT_DLTYPE_TOP
-#define LT_DLTYPE_TOP &dld
+#undef LTDL_TYPE_TOP
+#define LTDL_TYPE_TOP &dld
#endif
{
lt_ptr_t address = GetProcAddress(handle->handle, symbol);
- if (!address)
+ if (!address)
last_error = unknown_error;
return address;
}
static
lt_dltype_t
-wll = { LT_DLTYPE_TOP, 0, wll_init, wll_exit,
+wll = { LTDL_TYPE_TOP, 0, wll_init, wll_exit,
wll_open, wll_close, wll_sym };
-#undef LT_DLTYPE_TOP
-#define LT_DLTYPE_TOP &wll
+#undef LTDL_TYPE_TOP
+#define LTDL_TYPE_TOP &wll
#endif
-#if HAVE_DLPREOPEN
-
/* emulate dynamic linking using preloaded_symbols */
typedef struct lt_dlsymlists_t {
{
preloaded_symbols = 0;
if (default_preloaded_symbols)
- return lt_dlpreopen(default_preloaded_symbols);
+ return lt_dlpreload(default_preloaded_symbols);
return 0;
}
static
lt_dltype_t
-presym = { LT_DLTYPE_TOP, 0, presym_init, presym_exit,
+presym = { LTDL_TYPE_TOP, 0, presym_init, presym_exit,
presym_open, presym_close, presym_sym };
-#undef LT_DLTYPE_TOP
-#define LT_DLTYPE_TOP &presym
-
-#endif
+#undef LTDL_TYPE_TOP
+#define LTDL_TYPE_TOP &presym
-static lt_dlhandle handles;
+static char usr_search_path[LTDL_SEARCHPATH_MAX];
+static lt_dlhandle handles = 0;
static int initialized = 0;
-static lt_dltype types = LT_DLTYPE_TOP;
-#undef LT_DLTYPE_TOP
+static lt_dltype types = LTDL_TYPE_TOP;
+#undef LTDL_TYPE_TOP
int
lt_dlinit ()
return 0;
}
handles = 0;
+ usr_search_path[0] = '\0'; /* empty search path */
while (*type) {
if ((*type)->mod_init())
}
int
-lt_dlpreopen (preloaded)
+lt_dlpreload (preloaded)
const lt_dlsymlist *preloaded;
{
-#if HAVE_DLPREOPEN
if (preloaded)
return presym_add_symlist(preloaded);
- else {
- presym_free_symlists();
- if (default_preloaded_symbols)
- return lt_dlpreopen(default_preloaded_symbols);
- return 0;
- }
-#else
- last_error = dlpreopen_not_supported_error;
- return 1;
-#endif
+ presym_free_symlists();
+ if (default_preloaded_symbols)
+ return lt_dlpreload(default_preloaded_symbols);
+ return 0;
}
int
-lt_dlpreopen_default_ (preloaded)
+lt_dlpreload_default (preloaded)
const lt_dlsymlist *preloaded;
{
-#if HAVE_DLPREOPEN
default_preloaded_symbols = preloaded;
return 0;
-#else
- last_error = dlpreopen_not_supported_error;
- return 1;
-#endif
}
int
return 0;
}
-/* max. filename length */
-#ifndef FILENAME_MAX
-#define FILENAME_MAX 1024
-#endif
-
static int
find_module (handle, dir, libdir, dlname, old_name)
lt_dlhandle *handle;
const char *dlname;
const char *old_name;
{
- char fullname[FILENAME_MAX];
+ char filename[LTDL_FILENAME_MAX];
/* search for old library first; if it was dlpreopened, we
want the preopened version of it, even if a dlopenable
/* search a module */
if (*dlname) {
- /* try to open the installed module */
- if (strlen(libdir)+strlen(dlname)+1 < FILENAME_MAX) {
- strcpy(fullname, libdir);
- strcat(fullname, "/");
- strcat(fullname, dlname);
- if (tryall_dlopen(handle, fullname) == 0)
+ /* try to open the not-installed module */
+ if (strlen(dir)+strlen(dlname)+6 < LTDL_FILENAME_MAX) {
+ /* FIXME: we assume that LTDL_OBJDIR is 6 character long */
+ strcpy(filename, dir);
+ strcat(filename, LTDL_OBJDIR "/");
+ strcat(filename, dlname);
+ if (tryall_dlopen(handle, filename) == 0)
return 0;
}
- /* try to open the not-installed module */
- if (strlen(dir)+strlen(dlname)+6 < FILENAME_MAX) {
- strcpy(fullname, dir);
- strcat(fullname, ".libs/");
- strcat(fullname, dlname);
- if (tryall_dlopen(handle, fullname) == 0)
+ /* try to open the installed module */
+ if (strlen(libdir)+strlen(dlname)+1 < LTDL_FILENAME_MAX) {
+ strcpy(filename, libdir);
+ strcat(filename, "/");
+ strcat(filename, dlname);
+ if (tryall_dlopen(handle, filename) == 0)
return 0;
}
- if (strlen(dir)+strlen(dlname) < FILENAME_MAX) {
- strcpy(fullname, dir);
- strcat(fullname, dlname);
- if (tryall_dlopen(handle, fullname) == 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;
}
}
}
static int
-find_library (handle, filename, have_dir, basename, search_path)
+find_library (handle, basename, search_path)
lt_dlhandle *handle;
- const char *filename;
- int have_dir;
const char *basename;
const char *search_path;
{
- char dir[FILENAME_MAX], fullname[FILENAME_MAX];
- const char *p, *next;
+ char filename[LTDL_FILENAME_MAX];
+ const char *cur, *next;
- if (have_dir || !search_path) {
+ if (!search_path || !strlen(search_path)) {
last_error = file_not_found_error;
return 1;
}
- /* try other directories */
-
- /* search_path is a colon-separated
- list of search directories */
- p = search_path;
- while (p) {
- next = strchr(p, ':');
+ cur = search_path;
+ while (cur) {
+ next = strchr(cur, ':');
if (next) {
- if (next - p + 1 >= FILENAME_MAX) {
+ if (next - cur + 1 >= FILENAME_MAX) {
last_error = buffer_overflow_error;
return 1;
}
- strncpy(dir, p, next - p);
- dir[next - p] = '\0';
- p = next+1;
+ strncpy(filename, cur, next - cur);
+ filename[next - cur] = '\0';
+ cur = next+1;
} else {
- if (strlen(p)+1 >= FILENAME_MAX) {
+ if (strlen(cur)+1 >= FILENAME_MAX) {
last_error = buffer_overflow_error;
return 1;
}
- strcpy(dir, p);
- p = 0;
+ strcpy(filename, cur);
+ cur = 0;
}
- if (!*dir)
+ if (!*filename)
continue;
- strcat(dir, "/");
- if (strlen(dir)+strlen(basename) < FILENAME_MAX) {
- strcpy(fullname, dir);
- strcat(fullname, basename);
- if (tryall_dlopen(handle, fullname) == 0)
- return 0;
+ strcat(filename, "/");
+ if (strlen(filename)+strlen(basename) < LTDL_FILENAME_MAX) {
+ strcat(filename, basename);
+ if (tryall_dlopen(handle, filename) == 0)
+ return 0;
}
}
last_error = file_not_found_error;
return 1;
}
-#undef READTEXT_MODE
-/* fopen() mode flags for reading a text file */
-#ifdef _WIN32
-#define READTEXT_MODE "rt"
-#else
-#define READTEXT_MODE "r"
-#endif
-
static FILE *
-find_file (filename, basename, have_dir, search_path)
- const char *filename;
- int have_dir;
+find_file (basename, search_path)
const char *basename;
const char *search_path;
{
- char dir[FILENAME_MAX], fullname[FILENAME_MAX];
- const char *p, *next;
+ char filename[LTDL_FILENAME_MAX];
+ const char *cur, *next;
FILE *file;
- if (have_dir || !search_path) {
+ if (!search_path || !strlen(search_path)) {
last_error = file_not_found_error;
return 0;
}
- /* try other directories */
-
- /* search_path is a colon-separated
- list of search directories */
- p = search_path;
- while (p) {
- next = strchr(p, ':');
+ cur = search_path;
+ while (cur) {
+ next = strchr(cur, ':');
if (next) {
- if (next - p + 1 >= FILENAME_MAX) {
+ if (next - cur + 1 >= LTDL_FILENAME_MAX) {
last_error = buffer_overflow_error;
return 0;
}
- strncpy(dir, p, next - p);
- dir[next - p] = '\0';
- p = next+1;
+ strncpy(filename, cur, next - cur);
+ filename[next - cur] = '\0';
+ cur = next+1;
} else {
- if (strlen(p)+1 >= FILENAME_MAX) {
+ if (strlen(cur)+1 >= LTDL_FILENAME_MAX) {
last_error = buffer_overflow_error;
return 0;
}
- strcpy(dir, p);
- p = 0;
+ strcpy(filename, cur);
+ cur = 0;
}
- if (!*dir)
+ if (!*filename)
continue;
- strcat(dir, "/");
- if (strlen(dir)+strlen(basename) < FILENAME_MAX) {
- strcpy(fullname, dir);
- strcat(fullname, basename);
- file = fopen(fullname, READTEXT_MODE);
+ strcat(filename, "/");
+ if (strlen(filename)+strlen(basename) < LTDL_FILENAME_MAX) {
+ strcat(filename, basename);
+ file = fopen(filename, LTDL_READTEXT_MODE);
if (file)
return file;
}
static int
load_deplibs(handle, deplibs)
- lt_dlhandle *handle;
+ lt_dlhandle handle;
const char *deplibs;
{
/* FIXME: load deplibs */
+ handle->depcount = 0;
+ handle->deps = 0;
return 0;
}
static int
unload_deplibs(handle)
- lt_dlhandle *handle;
+ lt_dlhandle handle;
{
/* FIXME: unload deplibs */
return 0;
const char *filename;
{
lt_dlhandle handle;
- char dir[FILENAME_MAX];
+ char dir[LTDL_FILENAME_MAX];
const char *basename, *ext, *search_path;
#ifdef LTDL_SHLIBPATH_VAR
const char *sys_search_path;
/* check whether we open a libtool module (.la extension) */
ext = strrchr(basename, '.');
if (ext && strcmp(ext, ".la") == 0) {
- char dlname[FILENAME_MAX], old_name[FILENAME_MAX];
- char libdir[FILENAME_MAX], deplibs[FILENAME_MAX];
- char tmp[FILENAME_MAX];
+ char dlname[LTDL_FILENAME_MAX], old_name[LTDL_FILENAME_MAX];
+ char libdir[LTDL_FILENAME_MAX], deplibs[LTDL_FILENAME_MAX];
+ char tmp[LTDL_FILENAME_MAX];
char *name;
FILE *file;
int i;
dlname[0] = old_name[0] = libdir[0] = deplibs[0] = '\0';
/* extract the module name from the file name */
- if (strlen(basename) >= FILENAME_MAX) {
+ if (strlen(basename) >= LTDL_FILENAME_MAX) {
last_error = buffer_overflow_error;
return 0;
}
last_error = memory_error;
return 0;
}
- file = fopen(filename, READTEXT_MODE);
- if (!file)
- file = find_file(filename, *dir, basename,
- usr_search_path);
- if (!file)
- file = find_file(filename, *dir, basename,
- search_path);
+ file = fopen(filename, LTDL_READTEXT_MODE);
+ if (!file && !*dir) {
+ /* try other directories */
+ file = find_file(basename, usr_search_path);
+ if (!file)
+ file = find_file(basename, search_path);
#ifdef LTDL_SHLIBPATH_VAR
- if (!file)
- file = find_file(filename, *dir, basename,
- sys_search_path);
+ if (!file)
+ file = find_file(basename, sys_search_path);
#endif
+ }
if (!file) {
free(name);
- handle = (lt_dlhandle)0;
-#ifdef LTDL_SHLIB_EXT
- /* Try with the shared library extension */
- name = malloc(strlen(filename) -
- 3 /*i.e., strlen(".la") */
- + strlen(LTDL_SHLIB_EXT)
- + 1 /* '\0' */);
- if (name) {
- strcpy(name, filename);
- strcpy(name + strlen(filename) - 3,
- LTDL_SHLIB_EXT);
- handle = lt_dlopen(name);
- free(name);
- }
-#endif
- return handle;
+ return 0;
}
while (!feof(file)) {
- if (!fgets(tmp, FILENAME_MAX, file))
+ if (!fgets(tmp, LTDL_FILENAME_MAX, file))
break;
if (strncmp(tmp, "dlname=", 7) == 0)
trim(dlname, &tmp[7]);
last_error = memory_error;
return 0;
}
- if (tryall_dlopen(&handle, filename)
- && find_library(&handle, filename, *dir,
- basename, usr_search_path)
- && find_library(&handle, filename, *dir,
- basename, search_path)
+ if (tryall_dlopen(&handle, filename) && !*dir
+ && find_library(&handle, basename, usr_search_path)
+ && find_library(&handle, basename, search_path)
#ifdef LTDL_SHLIBPATH_VAR
- && find_library(&handle, filename, *dir,
- basename, sys_search_path)
+ && find_library(&handle, basename, sys_search_path)
#endif
) {
free(handle);
return 0;
}
-#undef LT_SYMBOL_LENGTH
-/* This is the maximum symbol size that won't require malloc/free */
-#define LT_SYMBOL_LENGTH 256
-
-#undef LT_SYMBOL_OVERHEAD
-/* This accounts for the _LTX_ separator and the string terminator */
-#define LT_SYMBOL_OVERHEAD 7
-
lt_ptr_t
lt_dlsym (handle, symbol)
lt_dlhandle handle;
const char *symbol;
{
int lensym;
- char lsym[LT_SYMBOL_LENGTH];
+ char lsym[LTDL_SYMBOL_LENGTH];
char *sym;
lt_ptr_t address;
lensym += strlen(handle->type->sym_prefix);
if (handle->name)
lensym += strlen(handle->name);
- if (lensym + LT_SYMBOL_OVERHEAD < LT_SYMBOL_LENGTH)
+ if (lensym + LTDL_SYMBOL_OVERHEAD < LTDL_SYMBOL_LENGTH)
sym = lsym;
else
- sym = malloc(lensym + LT_SYMBOL_OVERHEAD);
+ sym = malloc(lensym + LTDL_SYMBOL_OVERHEAD);
if (!sym) {
last_error = buffer_overflow_error;
return 0;
if (handle->type->sym_prefix) {
strcpy(sym, handle->type->sym_prefix);
strcat(sym, handle->name);
- } else
+ } else
strcpy(sym, handle->name);
strcat(sym, "_LTX_");
strcat(sym, symbol);
if (handle->type->sym_prefix) {
strcpy(sym, handle->type->sym_prefix);
strcat(sym, symbol);
- } else
+ } else
strcpy(sym, symbol);
address = handle->type->find_sym(handle, sym);
if (sym != lsym)
return error;
}
-const char *
-lt_dlsearchpath (search_path)
+int
+lt_dladdsearchdir (search_dir)
+ const char *search_dir;
+{
+ if (!search_dir) {
+ usr_search_path[0] = '\0'; /* reset the search path */
+ return 0;
+ }
+ if (!strlen(search_dir))
+ return 0;
+ if (strlen(usr_search_path) + strlen(search_dir) + 1
+ >= LTDL_SEARCHPATH_MAX) {
+ last_error = buffer_overflow_error;
+ return 1;
+ }
+ if (usr_search_path[0] != '\0')
+ strcat(usr_search_path, ":");
+ strcat(usr_search_path, search_dir);
+ return 0;
+}
+
+int
+lt_dlsetsearchpath (search_path)
const char *search_path;
{
- const char *old_path = usr_search_path;
-
- usr_search_path = search_path;
- return old_path;
+ if (!search_path) {
+ usr_search_path[0] = '\0'; /* reset the search path */
+ return 0;
+ }
+ if (!strlen(search_path))
+ return 0;
+ if (strlen(search_path) >= LTDL_SEARCHPATH_MAX) {
+ last_error = buffer_overflow_error;
+ return 1;
+ }
+ strcpy(usr_search_path, search_path);
+ return 0;
+}
+
+const char *
+lt_dlgetsearchpath (void)
+{
+ return usr_search_path;
}
__BEGIN_DECLS
_LTDLL_EXTERN int lt_dlinit __P((void));
-_LTDLL_EXTERN int lt_dlpreopen __P((const lt_dlsymlist *preloaded));
-_LTDLL_EXTERN int lt_dlpreopen_default_ __P((const lt_dlsymlist *preloaded));
+_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 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));
-_LTDLL_EXTERN const char *lt_dlsearchpath __P((const char *search_path));
+_LTDLL_EXTERN int lt_dladdsearchdir __P((const char *search_dir));
+_LTDLL_EXTERN int lt_dlsetsearchpath __P((const char *search_path));
+_LTDLL_EXTERN const char *lt_dlgetsearchpath __P((void));
+
+#define LTDL_PRELOADED_SYMBOLS extern const lt_dlsymlist lt_preloaded_symbols[];
+#define LTDL_SET_PRELOADED_SYMBOLS() lt_dlpreload_default(lt_preloaded_symbols)
-extern const lt_dlsymlist lt_preloaded_symbols[];
-#define lt_dlpreopen_default() lt_dlpreopen_default_(lt_preloaded_symbols)
__END_DECLS
#endif /* !_LTDL_H_ */
sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%'
changequote([,])dnl
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
case "$host_os" in
cygwin*)
- # Convert to a UNC path for cygwin
- test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"`
+ # Convert to a UNC path for cygwin
+ test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"`
;;
*)
- test -z "$LD" && LD="$ac_prog"
+ test -z "$LD" && LD="$ac_prog"
;;
esac
;;
changequote([,])dnl
sub_uncdir='s%\\%/%g'
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"`
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"`
done
case "$host_os" in
cygwin*)
- # Convert to a UNC path for cygwin
- test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"`
+ # Convert to a UNC path for cygwin
+ test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"`
;;
*)
- test -z "$LD" && LD="$ac_prog"
+ test -z "$LD" && LD="$ac_prog"
;;
esac
;;
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
- test "$with_gnu_ld" != yes && break
+ test "$with_gnu_ld" != yes && break
fi
fi
done
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- ac_cv_path_NM="$ac_dir/nm -B"
+ ac_cv_path_NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- ac_cv_path_NM="$ac_dir/nm -p"
+ ac_cv_path_NM="$ac_dir/nm -p"
break
else
- ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
# Try sorting and uniquifying the output.
if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
- mv -f "$ac_nlist"T "$ac_nlist"
- ac_wcout=`wc "$ac_nlist" 2>/dev/null`
+ mv -f "$ac_nlist"T "$ac_nlist"
+ ac_wcout=`wc "$ac_nlist" 2>/dev/null`
changequote(,)dnl
- ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
+ ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
changequote([,])dnl
- (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
+ (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
else
- rm -f "$ac_nlist"T
- ac_count=-1
+ rm -f "$ac_nlist"T
+ ac_count=-1
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
- if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
#endif
EOF
- # Now generate the symbol file.
- sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
+ # Now generate the symbol file.
+ sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
cat <<EOF >> conftest.c
#if defined (__STDC__) && __STDC__
changequote([,])dnl
{
EOF
- sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
- cat <<\EOF >> conftest.c
+ sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
+ cat <<\EOF >> conftest.c
{0, (lt_ptr_t) 0}
};
}
#endif
EOF
- # Now try linking the two files.
- mv conftest.$ac_objext conftestm.$ac_objext
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftestm.$ac_objext
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
- LIBS="conftestm.$ac_objext"
+ LIBS="conftestm.$ac_objext"
CFLAGS="$CFLAGS$no_builtin_flag"
- if AC_TRY_EVAL(ac_link) && test -s conftest; then
- ac_pipe_works=yes
- else
- echo "configure: failed program was:" >&AC_FD_CC
- cat conftest.c >&AC_FD_CC
- fi
- LIBS="$ac_save_LIBS"
+ if AC_TRY_EVAL(ac_link) && test -s conftest; then
+ ac_pipe_works=yes
+ else
+ echo "configure: failed program was:" >&AC_FD_CC
+ cat conftest.c >&AC_FD_CC
+ fi
+ LIBS="$ac_save_LIBS"
CFLAGS="$ac_save_CFLAGS"
- else
- echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
- fi
+ else
+ echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
+ fi
else
- echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
+ echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
ac_cv_sys_symbol_underscore=yes
else
if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then
- :
+ :
else
- echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
+ echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
fi
else
fi
-if (cd $pkgdatadir && ls); then :
-else
+files=`cd $pkgdatadir && ls`
+if test -z "$files"; then
echo "$progname: cannot list files in \`$pkgdatadir'" 1>&2
exit 1
fi
test -z "$localserial" && localserial=0
if test "$localserial" -lt "$instserial"; then
- echo "You should $updatemsg."
+ echo "You should $updatemsg."
elif test "$localserial" -gt "$instserial"; then
echo "$progname: \`$libtool_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2
if test -z "$force"; then
fi
done
+if test "x$ltdl" = xyes; then
+ if tar xzf $pkgdatadir/libltdl.tar.gz; then :
+ else
+ echo "$progname: cannot unpack libltdl.tar.gz" 1>&2
+ status=1
+ fi
+fi
+
exit $status
# Local Variables:
if test "$with_gcc" = yes; then
# collect2 in egcs and probably latest gcc has full support for
# -shared flag, so we feel much better.
- archive_cmds='$CC -shared $thread_safe_flags -o $objdir/$soname $libobjs $deplibs'
+ archive_cmds='$CC -shared -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~
$CC -o $objdir/$soname $libobjs $deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry'
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
- mv -f "$nlist"T "$nlist"
+ mv -f "$nlist"T "$nlist"
else
- rm -f "$nlist"T
+ rm -f "$nlist"T
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$nlist" >/dev/null; then
- if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
cat conftest.c >&5
fi
LIBS="$save_LIBS"
- else
+ else
echo "cannot find nm_test_func in $nlist" >&5
- fi
+ fi
else
- echo "cannot find nm_test_var in $nlist" >&5
+ echo "cannot find nm_test_var in $nlist" >&5
fi
else
echo "cannot run $global_symbol_pipe" >&5
shlibpath_var=
version_type=none
dynamic_linker="$host_os ld.so"
-sys_lib_search_path="/lib /usr/lib /usr/local/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
file_magic_command=
-deplibs_check_method='unkwnon'
+deplibs_check_method='unknown'
# Need to set the preceding variable on all platforms that support
# interlibrary dependencies.
# 'none' -- dependencies not supported.
shlibpath_var=LD_LIBRARY_PATH
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
file_magic_command=file
- sys_lib_search_path="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`"
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`"
if test -f /lib/ld.so.1; then
dynamic_linker='GNU ld.so'
postinstall_cmds='chmod +x $lib'
deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
file_magic_command="file"
- sys_lib_search_path="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`"
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`"
;;
sunos4*)
old_postuninstall_cmds archive_cmds archive_sym_cmds postinstall_cmds postuninstall_cmds \
file_magic_command deplibs_check_method allow_undefined_flag no_undefined_flag \
finish_cmds finish_eval global_symbol_pipe \
- hardcode_libdir_flag_spec hardcode_libdir_separator sys_lib_search_path \
+ hardcode_libdir_flag_spec hardcode_libdir_separator sys_lib_search_path_spec \
compiler_c_o compiler_o_lo need_locks; do
case "$var" in
old_postinstall_cmds | old_postuninstall_cmds | \
archive_cmds | archive_sym_cmds | \
postinstall_cmds | postuninstall_cmds | \
- finish_cmds | sys_lib_search_path)
+ finish_cmds | sys_lib_search_path_spec)
# Double-quote double-evaled strings.
eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`\\\""
;;
hardcode_shlibpath_var=$hardcode_shlibpath_var
# System search path for libraries
-sys_lib_search_path=$sys_lib_search_path
+sys_lib_search_path_spec=$sys_lib_search_path_spec
# Fix the shell variable \$srcfile for the compiler.
fix_srcfile_path="$fix_srcfile_path"
# #include <windows.h>
# #undef WIN32_LEAN_AND_MEAN
# #include <stdio.h>
-#
+#
# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
-#
+#
# #include <cygwin/cygwin_dll.h>
# DECLARE_CYGWIN_DLL( DllMain );
# HINSTANCE __hDllInstance_base;
-#
+#
# BOOL APIENTRY
# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
# {
convenience=
old_convenience=
deplibs=
- eval lib_search_path=\"$sys_lib_search_path\"
+ eval lib_search_path=\"$sys_lib_search_path_spec\"
- avoid_versioning=no
+ avoid_version=no
dlfiles=
dlprefiles=
dlpredeps=
continue
;;
- -avoid-versioning)
- avoid_versioning=yes
+ -avoid-version)
+ avoid_version=yes
continue
;;
;;
-R*)
- xrpath="$xrpath "`echo "X$arg" | $Xsed -e 's/^-R//'`
+ xrpath="$xrpath "`echo "X$arg" | $Xsed -e 's/^-R//'`
continue
;;
*.la)
# Make sure we only generate libraries of the form `libNAME.la'.
case "$outputname" in
- lib*)
+ lib*)
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
eval libname=\"$libname_spec\"
;;
esac
if test -n "$xrpath"; then
- temp_xrpath=
- for libdir in $xrpath; do
+ temp_xrpath=
+ for libdir in $xrpath; do
temp_xrpath="$temp_xrpath -R$libdir"
done
deplibs="$temp_xrpath $deplibs"
fi
# Remove version info from name if versioning should be avoided
- if test "$avoid_versioning" = yes && test "$need_version" = no; then
+ if test "$avoid_version" = yes && test "$need_version" = no; then
major=
versuffix=
verstring=""
major=""
newdeplibs=
case "$deplibs_check_method" in
- pass_all)
- newdeplibs=$deplibs
+ pass_all)
+ newdeplibs=$deplibs
;; # Don't check for shared/static. Everything works.
# This might be a little naive. We might want to check
# whether the library exists or not. But this is on
This mode accepts the following additional options:
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
-static always build a \`.o' file suitable for static linking
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
The following components of LINK-COMMAND are treated specially:
-all-static do not do any dynamic linking at all
- -avoid-versioning do not add a version suffix if possible
+ -avoid-version do not add a version suffix if possible
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
lib_LTLIBRARIES = foo1.la libfoo2.la
foo1_la_SOURCES = foo1.c
-foo1_la_LDFLAGS = $(LIBADD_M) -module -avoid-versioning
+foo1_la_LDFLAGS = $(LIBADD_M) -module -avoid-version
libfoo2_la_SOURCES = foo2.c
libfoo2_la_LDFLAGS = $(LIBADD_M) -module
#include "ltdl.h"
#include <stdio.h>
+/* the dlpreopened modules */
+LTDL_PRELOADED_SYMBOLS;
+
int
test_dl (char *filename)
{
fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
}
+ LTDL_SET_PRELOADED_SYMBOLS();
if (lt_dlinit() != 0) {
fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
return 1;
}
- if (lt_dlpreopen(lt_preloaded_symbols) != 0) {
- fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
- return 1;
- }
for (i = 1; i < argc; i++)
if (test_dl(argv[i]))