+1998-12-25 Thomas Tanner <tanner@gmx.de>
+
+ * depdemo/configure.in: removed last relics of demo
+ * depdemo/sysdep.h: ditto
+ * mdemo/Makefile.am: ditto
+ * libltdl/Makefile.am: fixed the version number, build libltdls if
+ -enable-install and -enable-dlpreopen are enabled
+ * libltdl/configure.in: libltdl is version 0.1, not 1.0,
+ renamed -enable-ltdl-install to -enable-install,
+ conditionals for libltdls, check for strchr and index,
+ replaced NULL with 0
+ * libltdl/ltdl.c: replaced NULL with 0, dlpreopen only if
+ USE_DLPREOPEN was defined, integrated shl_load code from GModule
+ (still untested)
+
1998-12-24 Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
* libltdl/configure.in: fixup spacing in --enable-ltdl-install
config.*
conftest*
libtool
+*.lo
+*.la
depdemo
depdemo.static
-dnl Initialize the hell package.
+dnl Initialize the depdemo package.
AC_INIT(main.c)
AM_INIT_AUTOMAKE(depdemo,0.1)
-/* foo.h -- interface to the libfoo* libraries
+/* sysdep.h -- system dependent declarations
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
# A brief demonstration of using Automake with Libtool. -*-Makefile-*-
#
-# NOTE: Don't forget that in the libtool distribution, files in this
-# directory are distributed by the demo_distfiles variable in the top
-# level Makefile.
AUTOMAKE_OPTIONS = no-dependencies foreign
-LTDL_VERSION = -version-info 0:1:1
+LTDL_VERSION = -version-info 0:1:0
+
+ltdls.lo: ltdl.c
+ $(LTCOMPILE) -DUSE_DLPREOPEN -o $@ -c $<
+
+lib_LTLIBRARIES = @LIBLIBS@
+noinst_LTLIBRARIES = @NOINSTLIBS@
+EXTRA_LTLIBRARIES = libltdl.la libltdls.la
if INSTALL_LTDL
-LTDL_FLAGS = $(LTDL_VERSION) -rpath $(libdir)
+LTDL_FLAGS = $(LTDL_VERSION) -rpath $(libdir)
include_HEADERS = ltdl.h
else
LTDL_FLAGS =
noinst_HEADERS = ltdl.h
endif
-EXTRA_LTLIBRARIES = libltdl.la
-
-lib_LTLIBRARIES = @LIBLIBS@
-noinst_LTLIBRARIES = @NOINSTLIBS@
-
-libltdl_la_SOURCES = ltdl.c
+libltdl_la_SOURCES = ltdl.c ltdl.h
libltdl_la_LDFLAGS = $(LTDL_FLAGS) $(LIBADD_DL)
+libltdls_la_LIBADD = ltdls.lo
+libltdls_la_SOURCES = ltdl.h
+libltdls_la_LDFLAGS = $(LTDL_FLAGS) $(LIBADD_DL)
# rebuild the libtool script if needed
ltdl.lo: libtool
dnl Process this file with autoconf to create configure.
-dnl Initialize the ltdl package.
+dnl Initialize the libltdl package.
AC_INIT(ltdl.c)
-AM_INIT_AUTOMAKE(libltdl,1.0)
+AM_INIT_AUTOMAKE(libltdl,0.1)
-AC_ARG_ENABLE(ltdl-install,
- [ --enable-ltdl-install install libltdl (breaks check before install)])
-AM_CONDITIONAL(INSTALL_LTDL, test x$enable_ltdl_install = xyes)
-if test x$enable_ltdl_install = xyes; then
+AC_ARG_ENABLE(install,
+ [ --enable-install build installable version])
+AM_CONDITIONAL(INSTALL_LTDL, test x$enable_install = xyes)
+
+AC_ARG_ENABLE(dlpreopen,
+ [ --enable-dlpreopen build installable version with dlpreopen support])
+
+dnl Always use dld_preloaded_symbols?
+always_dlpreopen=yes
+
+if test x$enable_install = xyes; then
LIBLIBS=libltdl.la
+ test x$enable_dlpreopen = xyes && LIBLIBS="$LIBLIBS libltdls.la"
NOINSTLIBS=
+ always_dlpreopen=no
else
LIBLIBS=
NOINSTLIBS=libltdl.la
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(string.h strings.h, break)
-AC_CHECK_FUNCS(strdup strrchr rindex)
+AC_CHECK_FUNCS(strdup strchr strrchr index rindex)
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
libltdl_cv_dlpreopen, [dnl
if test "$supported" = no; then
AC_MSG_WARN(Can't find dlopen support: Please make sure that your programs use -dlopen/-dlpreopen.)
- AC_DEFINE(DEBUG)
+ always_dlpreopen=yes
+fi
+
+if test "$always_dlpreopen" = yes; then
+ AC_DEFINE(USE_DLPREOPEN)
fi
AM_SYS_SYMBOL_UNDERSCORE
#include <dlfcn.h>
#include <stdio.h>
fnord() { int i=42;}
-main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,RTLD_LAZY);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 && !ptr2) exit(0); } exit(1); }
], libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
lt_ptr_t (*find_sym) __P((lt_dlhandle handle, const char *symbol));
} lt_dltype_t, *lt_dltype;
-#define LT_DLTYPE_TOP NULL
+#define LT_DLTYPE_TOP 0
typedef struct lt_dlhandle_t {
struct lt_dlhandle_t *next;
for (p = str; *p != (char)ch && p != '\0'; p++)
/*NOWORK*/;
- return (*p == (char)ch) ? p : NULL;
+ return (*p == (char)ch) ? p : 0;
}
# endif
while (*p != (char)ch && p >= str)
p--;
- return (*p == (char)ch) ? p : NULL;
+ return (*p == (char)ch) ? p : 0;
}
# endif
#include <dl.h>
#endif
+/* the following lines are (c) Tim Janik */
+
+/* some flags are missing on some systems, so we provide
+ * harmless defaults.
+ *
+ * Mandatory:
+ * BIND_IMMEDIATE - Resolve symbol references when the library is loaded.
+ * BIND_DEFERRED - Delay code symbol resolution until actual reference.
+ *
+ * Optionally:
+ * BIND_FIRST - Place the library at the head of the symbol search order.
+ * BIND_NONFATAL - The default BIND_IMMEDIATE behavior is to treat all unsatisfied
+ * symbols as fatal. This flag allows binding of unsatisfied code
+ * symbols to be deferred until use.
+ * [Perl: For certain libraries, like DCE, deferred binding often
+ * causes run time problems. Adding BIND_NONFATAL to BIND_IMMEDIATE
+ * still allows unresolved references in situations like this.]
+ * BIND_NOSTART - Do not call the initializer for the shared library when the
+ * library is loaded, nor on a future call to shl_unload().
+ * BIND_VERBOSE - Print verbose messages concerning possible unsatisfied symbols.
+ *
+ * hp9000s700/hp9000s800:
+ * BIND_RESTRICTED - Restrict symbols visible by the library to those present at
+ * library load time.
+ * DYNAMIC_PATH - Allow the loader to dynamically search for the library specified
+ * by the path argument.
+ */
+#ifndef DYNAMIC_PATH
+#define DYNAMIC_PATH 0
+#endif /* DYNAMIC_PATH */
+#ifndef BIND_RESTRICTED
+#define BIND_RESTRICTED 0
+#endif /* BIND_RESTRICTED */
+
+#define OPT_BIND_FLAGS (BIND_IMMEDIATE | BIND_NONFATAL | BIND_VERBOSE | DYNAMIC_PATH)
+
static int
shl_init ()
{
lt_dlhandle handle;
const char *filename;
{
- /* Probably too much BIND_* flags */
- handle->handle = shl_load (filename, BIND_IMMEDIATE || BIND_FIRST ||
- BIND_TOGETHER || BIND_VERBOSE || DYNAMIC_PATH, 0L);
+ handle->handle = shl_load (filename, OPT_BIND_FLAGS, 0L);
+ /* the hp-docs say we should better abort() if errno==ENOSYM ;( */
return !(handle->handle);
}
lt_dlhandle handle;
const char *symbol;
{
- int status, i;
- struct shl_symbol *sym;
+ lt_ptr_t *sym;
- status = shl_getsymbols((shl_t) (handle->handle), TYPE_PROCEDURE,
- EXPORT_SYMBOLS, malloc, &sym);
- for (i = 0; i < status; i++)
- if (strcmp(symbol, sym[i].name) == 0)
- return sym[i].value;
- return 0;
+ if (shl_findsym ((shl_t) (handle->handle), symbol,
+ TYPE_UNDEFINED, &sym) || !(handle->handle) || !sym)
+ return 0;
+ return sym;
}
static
#endif
#if HAVE_DLPREOPEN
+#if USE_DLPREOPEN
/* emulate dynamic linking using dld_preloaded_symbols */
#undef LT_DLTYPE_TOP
#define LT_DLTYPE_TOP &dldpre
+#endif
#endif
static lt_dlhandle handles;
bin_PROGRAMS = mdemo mdemo.debug
-# Create a version of hell that does dlopen.
+# Create a version of mdemo that does dlopen.
mdemo_SOURCES = main.c
mdemo_LDADD = ../libltdl/libltdl.la \
-lm # We won't need this when libltdl takes care of dependencies