+1999-03-19 Thomas Tanner <tanner@gmx.de>
+
+ * use the same header in all configure.in's and Makefile.am's
+ * NEWS: improved support for BeOS and Cygwin
+ * TODO: ILD branch was merged, all internal variables and macros
+ are now documented
+ * demo/Makefile.am: use $(LIBS) instead of -lm
+ * doc/libtool.texi: documented new variable hardcode_into_libs
+ and thread_safe_flag_spec, renamed all AM_ENABLE/DISABLE_* macros
+ to AC_*, documented AC_DISABLE_FAST_INSTALL and AC_LIBTOOL_DLOPEN
+ * libltdl/ltdl.c: added two new error messages (cannot_open_error,
+ cannot_close_error), use them where approriate,
+ BeOS support (thanks to Xavier Pianet), on BeOS search modules
+ additionally in ADDON_PATH
+ * libtool.m4: rewrote AC_CHECK_LIBM: BeOS and Cygwin don't have
+ libm and *-ncr-sysv4.3* requires libmw
+ * ltconfig.in: don't check for LoadLibrary, hardcode dlopen
+ configuration for BeOS and Cygwin
+ * ltmain.in: fix sourcing of .la files on Solaris
+ (patch by Raja R Harinath)
+
1999-03-19 Alexandre Oliva <oliva@dcc.unicamp.br>
* ltconfig.in (sunos4*, with_gnu_ld, hardcode_minus_L): remove, we
-## Process Makefile.am with automake to create Makefile.in. -*-Makefile-*-
-## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = 1.3e gnits readme-alpha
* Various bugfixes
\f
New in 1.2g: CVS version, Libtool team:
-* Nothing so far
+* dlopen support for BeOS
+* Improved support for BeOS and Cygwin
\f
New in 1.2e: CVS version; 1.2f: 1999-03-15, Libtool team:
* libtool will correctly link uninstalled libraries into programs
* check whether the version of libtool.m4 is compatible
with ltconfig/ltmain.sh
-* Inter-library dependencies should be fully tracked by libtool
-and need to work for ltlibraries too. This requires looking up
-installed libtool libraries for transparent support.
-Thomas Tanner has a patch for this.
-
* Alexandre Oliva suggests that we should have an option to hardcode
paths into libraries, as well as binaries: `... -Wl,-soname
-Wl,/tmp/libtest.so.0 ...'. Tim Mooney wants the same thing.
* Lists of exported symbols should be stored in the pseudo library
so that the size of lt_preloaded_symbols can be reduced.
-* Documentation:
-
-- AC_PROG_LIBTOOL, AC_ENABLE/DISABLE_SHARED/STATIC/FAST_INSTALL,
- AC_LIBTOOL_DLOPEN, AC_LIBLTDL_CONVENIENCE/INSTALLABLE are not documented
-
-- Purpose and usage of convenience libraries must be better documented
-
-- some new internal variables are not documented yet.
+* Purpose and usage of convenience libraries must be better documented
In the future:
**************
-# A brief demonstration of Libtool modules. -*-Makefile-*-
-#
+## Process this file with automake to produce Makefile.in
+
AUTOMAKE_OPTIONS = no-dependencies foreign
EXTRA_DIST = acinclude.m4
-dnl Initialize the cdemo package.
+dnl Process this file with autoconf to create configure.
+
AC_INIT(main.c)
AM_INIT_AUTOMAKE(cdemo,0.1)
-# A brief demonstration of using Automake with Libtool. -*-Makefile-*-
-#
+## Process this file with automake to produce Makefile.in
+
AUTOMAKE_OPTIONS = no-dependencies foreign
EXTRA_DIST = $(TESTS) acinclude.m4
eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \
libdir=$(libdir); \
flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
- echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib -lm $$flag || echo unsupported > $@"; \
- eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib -lm $$flag || echo unsupported > $@"
+ echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $$flag || echo unsupported > $@"; \
+ eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $$flag || echo unsupported > $@"
hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
@eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \
echo "echo unsupported > $@"; \
echo unsupported > $@ || status="$$?"; \
else \
- echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello -lm"; \
- $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello -lm || status="$$?"; \
+ echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS)"; \
+ $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) || status="$$?"; \
fi; \
exit $$status
@eval `egrep -e '^(shlibpath_var|hardcode_.*|wl)=' libtool`; \
libdir=$(libdir); \
flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
- echo "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello -lm $$flag || echo unsupported > $@"; \
- eval "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello -lm $$flag || echo unsupported > $@"
+ echo "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $$flag || echo unsupported > $@"; \
+ eval "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $$flag || echo unsupported > $@"
hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
@rm -f hc-minusL
@eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \
libdir=$(libdir); \
flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
- echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello -lm $$flag || echo unsupported > $@"; \
- eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello -lm $$flag || echo unsupported > $@"
+ echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $$flag || echo unsupported > $@"; \
+ eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $$flag || echo unsupported > $@"
$(OBJECTS): libtool
libtool: $(LIBTOOL_DEPS)
-dnl Initialize the hell package.
+dnl Process this file with autoconf to create configure.
+
AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hell,1.0)
-# A brief demonstration of inter-library dependencies
-#
+## Process this file with automake to produce Makefile.in
+
AUTOMAKE_OPTIONS = no-dependencies foreign
SUBDIRS = l1 l2 l3 l4
-dnl Initialize the depdemo package.
+dnl Process this file with autoconf to create configure.
+
AC_INIT(main.c)
AM_INIT_AUTOMAKE(depdemo,0.1)
-# A brief demonstration of inter-library dependencies
-#
+## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir)
-# A brief demonstration of inter-library dependencies
-#
+## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir)
-# A brief demonstration of inter-library dependencies
-#
+## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir)
-# A brief demonstration of inter-library dependencies
-#
+## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir)
-## Process Makefile.am with automake to create Makefile.in. -*-Makefile-*-
-##
-## Copyright (C) 1996 Free Software Foundation, Inc.
-## This Makefile.am is free software; the Free Software Foundation
-## gives unlimited permission to copy, distribute and modify it.
-##
-## Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>
+## Process this file with automake to produce Makefile.in
+
AUTOMAKE_OPTIONS = gnits
info_TEXINFOS = libtool.texi
libtool_TEXINFOS = PLATFORMS
By default, this macro turns on shared libraries if they are available,
and also enables static libraries if they don't conflict with the shared
libraries. You can modify these defaults by calling either the
-@code{AM_DISABLE_SHARED} or @code{AM_DISABLE_STATIC} macros:
+@code{AC_DISABLE_SHARED} or @code{AC_DISABLE_STATIC} macros:
@example
# Turn off shared libraries during beta-testing, since they
# make the build process take too long.
-AM_DISABLE_SHARED
+AC_DISABLE_SHARED
AM_PROG_LIBTOOL
@end example
comma-separated @var{pkgs} list, and every other package with
@samp{--disable-shared}. The @samp{--enable-static=@var{pkgs}} flag
behaves similarly, but it uses @samp{--enable-static} and
-@samp{--disable-static}.
+@samp{--disable-static}. The same applies to the
+@samp{--enable-fast-install=@var{pkgs}} flag, which uses
+@samp{--enable-fast-install} and @samp{--disable-fast-install}.
The package name @samp{default} matches any packages which have not set
their name in the @code{PACKAGE} environment variable.
@end defmac
-@defmac AM_DISABLE_SHARED
+@defmac AC_LIBTOOL_DLOPEN
+Enable checking for dlopen support. This macro should be used if
+the package makes use of the -dlopen and -dlpreopen flags, otherwise
+libtool will assume that the system does not support dlopening.
+The macro must be called *before* @code{AM_PROG_LIBTOOL}.
+@end defmac
+
+@defmac AC_DISABLE_FAST_INSTALL
+Change the default behaviour for @code{AM_PROG_LIBTOOL} to disable
+optimization for fast installation. The user may still override
+this default by specifying @samp{--enable-fast-install}.
+@end defmac
+
+@defmac AC_DISABLE_SHARED
+@defmacx AM_DISABLE_SHARED
Change the default behaviour for @code{AM_PROG_LIBTOOL} to disable
shared libraries. The user may still override this default by
specifying @samp{--enable-shared}.
@end defmac
-@defmac AM_DISABLE_STATIC
+@defmac AC_DISABLE_STATIC
+@defmacx AM_DISABLE_STATIC
Change the default behaviour for @code{AM_PROG_LIBTOOL} to disable
static libraries. The user may still override this default by
specifying @samp{--enable-static}.
@defvar always_export_symbols
Whether libtool should automatically generate a list of exported symbols
using @var{export_symbols_cmds} before linking an archive.
-Set to @samp{yes} or @samp{no}. Default is @samp{no}
+Set to @samp{yes} or @samp{no}. Default is @samp{no}.
@end defvar
@defvar archive_cmds
@var{hardcode_libdir_flag_spec} is specified.
@end defvar
+@defvar hardcode_into_libs
+Whether the platform supports hardcoding of run-paths into libraries.
+If enabled, linking of programs will be much simpler but libraries will
+need to be relinked during installation.
+@end defvar
+
@defvar hardcode_libdir_flag_spec
Flag to hardcode a @var{libdir} variable into a binary, so that the
dynamic linker searches @var{libdir} for shared libraries at runtime.
as @code{-L} also augment the search path.
@end defvar
+@defvar thread_safe_flag_spec
+Linker flag (passed through the C compiler) used to generate thread-safe
+libraries.
+@end defvar
+
@defvar version_type
The library version numbering type. One of @samp{libtool},
@samp{linux}, @samp{osf}, @samp{sunos}, or @samp{none}.
-# A brief demonstration of using Automake with Libtool. -*-Makefile-*-
-#
+## Process this file with automake to produce Makefile.in
+
AUTOMAKE_OPTIONS = no-dependencies foreign
if INSTALL_LTDL
dnl Process this file with autoconf to create configure.
-dnl Initialize the libltdl package.
+
AC_INIT(ltdl.c)
if test -z "$enable_ltdl_install$enable_ltdl_convenience"; then
static const char dlopen_not_supported_error[] = "dlopen support not available";
static const char file_not_found_error[] = "file not found";
static const char no_symbols_error[] = "no symbols defined";
+static const char cannot_open_error[] = "can't open the module";
+static const char cannot_close_error[] = "can't close the module";
static const char symbol_error[] = "symbol not found";
static const char memory_error[] = "not enough memory";
static const char invalid_handle_error[] = "invalid handle";
# include <dlfcn.h>
#endif
-#if ! HAVE_DLERROR /* not all platforms have dlerror() */
-#define dlerror() unknown_error
-#endif
-
#ifdef RTLD_GLOBAL
# define LTDL_GLOBAL RTLD_GLOBAL
#else
{
handle->handle = dlopen(filename, LTDL_GLOBAL | LTDL_LAZY_OR_NOW);
if (!handle->handle) {
+#if HAVE_DLERROR
last_error = dlerror();
+#else
+ last_error = cannot_open_error;
+#endif
return 1;
}
return 0;
lt_dlhandle handle;
{
if (dlclose(handle->handle) != 0) {
+#if HAVE_DLERROR
last_error = dlerror();
+#else
+ last_error = cannot_close_error;
+#endif
return 1;
}
return 0;
lt_ptr_t address = dlsym(handle->handle, symbol);
if (!address)
+#if HAVE_DLERROR
last_error = dlerror();
+#else
+ last_error = symbol_error;
+#endif
return address;
}
{
handle->handle = shl_load(filename, LTDL_BIND_FLAGS, 0L);
if (!handle->handle) {
- last_error = unknown_error;
+ last_error = cannot_open_error;
return 1;
}
return 0;
lt_dlhandle handle;
{
if (shl_unload((shl_t) (handle->handle)) != 0) {
- last_error = unknown_error;
+ last_error = cannot_close_error;
return 1;
}
return 0;
if (shl_findsym((shl_t) (handle->handle), symbol, TYPE_UNDEFINED,
&address) != 0 || !(handle->handle) || !address) {
- last_error = unknown_error;
+ last_error = symbol_error;
return 0;
}
return address;
return 1;
}
if (dld_link(filename) != 0) {
- last_error = unknown_error;
+ last_error = cannot_open_error;
lt_dlfree(handle->handle);
return 1;
}
lt_dlhandle handle;
{
if (dld_unlink_by_file((char*)(handle->handle), 1) != 0) {
- last_error = unknown_error;
+ last_error = cannot_close_error;
return 1;
}
lt_dlfree(handle->filename);
lt_ptr_t address = dld_get_func(symbol);
if (!address)
- last_error = unknown_error;
+ last_error = symbol_error;
return address;
}
{
handle->handle = LoadLibrary(filename);
if (!handle->handle) {
- last_error = unknown_error;
+ last_error = cannot_open_error;
return 1;
}
return 0;
lt_dlhandle handle;
{
if (FreeLibrary(handle->handle) != 0) {
- last_error = unknown_error;
+ last_error = cannot_close_error;
return 1;
}
return 0;
lt_ptr_t address = GetProcAddress(handle->handle, symbol);
if (!address)
- last_error = unknown_error;
+ last_error = symbol_error;
return address;
}
#endif
+#ifdef __BEOS__
+
+/* dynamic linking for BeOS */
+
+#include <kernel/image.h>
+
+static int
+bedl_init ()
+{
+ return 0;
+}
+
+static int
+bedl_exit ()
+{
+ return 0;
+}
+
+static int
+bedl_open (handle, filename)
+ lt_dlhandle handle;
+ const char *filename;
+{
+ image_id image = 0;
+
+ if (filename) {
+ image = load_add_on(filename);
+ } else {
+ image_info info;
+ int32 cookie = 0;
+ if (get_next_image_info(0, &cookie, &info) == B_OK)
+ image = load_add_on(info.name);
+ }
+ if (image <= 0) {
+ last_error = cannot_open_error;
+ return 1;
+ }
+ handle->handle = (void*) image;
+ return 0;
+}
+
+static int
+bedl_close (handle)
+ lt_dlhandle handle;
+{
+ if (unload_add_on((image_id)handle->handle) != B_OK) {
+ last_error = cannot_close_error;
+ return 1;
+ }
+ return 0;
+}
+
+static lt_ptr_t
+bedl_sym (handle, symbol)
+ lt_dlhandle handle;
+ const char *symbol;
+{
+ lt_ptr_t address = 0;
+ image_id image = (image_id)handle->handle;
+
+ if (get_image_symbol(image, symbol, B_SYMBOL_TYPE_ANY,
+ &address) != B_OK) {
+ last_error = symbol_error;
+ return 0;
+ }
+ return address;
+}
+
+static
+lt_dltype_t
+bedl = { LTDL_TYPE_TOP, 0, bedl_init, bedl_exit,
+ bedl_open, bedl_close, bedl_sym };
+
+#undef LTDL_TYPE_TOP
+#define LTDL_TYPE_TOP &bedl
+
+#endif
+
/* emulate dynamic linking using preloaded_symbols */
typedef struct lt_dlsymlists_t {
file = (FILE*) find_file(basename,
getenv("LTDL_LIBRARY_PATH"),
&dir, 0);
+#ifdef __BEOS__
+ if (!file)
+ file = (FILE*) find_file(basename,
+ getenv("ADDON_PATH"),
+ &dir, 0);
+#endif
#ifdef LTDL_SHLIBPATH_VAR
if (!file)
file = (FILE*) find_file(basename,
])
# AC_CHECK_LIBM - check for math library
-AC_DEFUN(AC_CHECK_LIBM, [
-AC_CHECK_LIB(mw, _mwvalidcheckl)
-AC_CHECK_LIB(m, cos)
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+case "$host" in
+*-*-beos* | *-*-cygwin*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl)
+ AC_CHECK_LIB(m, cos)
+ ;;
+*)
+ AC_CHECK_LIB(m, cos)
+ ;;
+esac
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
library_names_spec='${libname}.so'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
;;
bsdi4*)
need_lib_prefix=no
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
;;
freebsd1*)
lt_cv_dlopen="shl_load"
else
echo "$ac_t""no" 1>&6
-echo $ac_n "checking for LoadLibrary""... $ac_c" 1>&6
-echo "$progname:@LINENO@: checking for LoadLibrary" >&5
-if eval "test \"`echo '$''{'ac_cv_func_LoadLibrary'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line @LINENO@ "ltconfig"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char LoadLibrary(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char LoadLibrary();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_LoadLibrary) || defined (__stub___LoadLibrary)
-choke me
-#else
-LoadLibrary();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo $progname:@LINENO@: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_LoadLibrary=yes"
-else
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_LoadLibrary=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'LoadLibrary`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- lt_cv_dlopen="LoadLibrary"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
fi
installed=yes
# Read the .la file
- . $lib
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
# Get the name of the library we link against.
linklib=
installed=yes
# Read the .la file
- . $lib
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
# Get the name of the library we link against.
linklib=
installed=yes
# Read the .la file
- . $lib
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
# Get the name of the library we link against.
linklib=
# Check to see that each library is installed.
libdir=
if test -f "$lib"; then
- . $lib
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib
+ esac
fi
libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
if test -n "$libdir" && test ! -f "$libfile"; then
-# A brief demonstration of Libtool modules. -*-Makefile-*-
-#
+## Process this file with automake to produce Makefile.in
+
AUTOMAKE_OPTIONS = no-dependencies foreign
INCLUDES = -I$(srcdir)/../libltdl
-dnl Initialize the mdemo package.
+dnl Process this file with autoconf to create configure.
+
AC_INIT(main.c)
AM_INIT_AUTOMAKE(mdemo,0.1)
-## Process this file with automake to create Makefile.in -*-Makefile-*-
+## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = gnits