From c7c32517c01edf94fafe145947ac8c7cfdedb7fd Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Fri, 25 Dec 1998 10:39:59 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 15 +++++++++++ depdemo/.cvsignore | 2 ++ depdemo/configure.in | 2 +- depdemo/sysdep.h | 2 +- libltdl/Makefile.am | 24 +++++++++-------- libltdl/configure.in | 31 +++++++++++++++------- libltdl/ltdl.c | 62 ++++++++++++++++++++++++++++++++++---------- mdemo/Makefile.am | 2 +- 8 files changed, 103 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9c95be80..9895738bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +1998-12-25 Thomas Tanner + + * 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 * libltdl/configure.in: fixup spacing in --enable-ltdl-install diff --git a/depdemo/.cvsignore b/depdemo/.cvsignore index 71b474bb2..ac1ecd2d3 100644 --- a/depdemo/.cvsignore +++ b/depdemo/.cvsignore @@ -7,5 +7,7 @@ configure config.* conftest* libtool +*.lo +*.la depdemo depdemo.static diff --git a/depdemo/configure.in b/depdemo/configure.in index 03de5cf2b..f1120a2a3 100644 --- a/depdemo/configure.in +++ b/depdemo/configure.in @@ -1,4 +1,4 @@ -dnl Initialize the hell package. +dnl Initialize the depdemo package. AC_INIT(main.c) AM_INIT_AUTOMAKE(depdemo,0.1) diff --git a/depdemo/sysdep.h b/depdemo/sysdep.h index 797669db7..d1785564f 100644 --- a/depdemo/sysdep.h +++ b/depdemo/sysdep.h @@ -1,4 +1,4 @@ -/* foo.h -- interface to the libfoo* libraries +/* sysdep.h -- system dependent declarations Copyright (C) 1998 Thomas Tanner This file is part of GNU Libtool. diff --git a/libltdl/Makefile.am b/libltdl/Makefile.am index 5347e5b96..c4dc80f6e 100644 --- a/libltdl/Makefile.am +++ b/libltdl/Makefile.am @@ -1,27 +1,29 @@ # 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 diff --git a/libltdl/configure.in b/libltdl/configure.in index 71444e1a3..4a576f979 100644 --- a/libltdl/configure.in +++ b/libltdl/configure.in @@ -1,14 +1,23 @@ 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 @@ -22,7 +31,7 @@ AM_PROG_LIBTOOL 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 @@ -49,7 +58,11 @@ AC_SUBST(LIBADD_DL) 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 @@ -62,7 +75,7 @@ if test x"$USE_SYMBOL_UNDERSCORE" = xyes; then #include #include 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, diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 46433da1d..6325515a4 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -62,7 +62,7 @@ typedef struct lt_dltype_t { 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; @@ -115,7 +115,7 @@ strchr(str, ch) for (p = str; *p != (char)ch && p != '\0'; p++) /*NOWORK*/; - return (*p == (char)ch) ? p : NULL; + return (*p == (char)ch) ? p : 0; } # endif @@ -145,7 +145,7 @@ strrchr(str, ch) while (*p != (char)ch && p >= str) p--; - return (*p == (char)ch) ? p : NULL; + return (*p == (char)ch) ? p : 0; } # endif @@ -224,6 +224,42 @@ dl = { LT_DLTYPE_TOP, dl_init, dl_exit, #include #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 () { @@ -241,9 +277,8 @@ shl_open (handle, filename) 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); } @@ -260,15 +295,12 @@ shl_sym (handle, symbol) 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 @@ -389,6 +421,7 @@ wll = { LT_DLTYPE_TOP, wll_init, wll_exit, #endif #if HAVE_DLPREOPEN +#if USE_DLPREOPEN /* emulate dynamic linking using dld_preloaded_symbols */ @@ -463,6 +496,7 @@ dldpre = { LT_DLTYPE_TOP, dldpre_init, dldpre_exit, #undef LT_DLTYPE_TOP #define LT_DLTYPE_TOP &dldpre +#endif #endif static lt_dlhandle handles; diff --git a/mdemo/Makefile.am b/mdemo/Makefile.am index 10c322789..e70528842 100644 --- a/mdemo/Makefile.am +++ b/mdemo/Makefile.am @@ -18,7 +18,7 @@ noinst_HEADERS = foo.h 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 -- 2.47.2