]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
*** empty log message ***
authorThomas Tanner <tanner@gmx.de>
Mon, 23 Nov 1998 21:26:38 +0000 (21:26 +0000)
committerThomas Tanner <tanner@gmx.de>
Mon, 23 Nov 1998 21:26:38 +0000 (21:26 +0000)
14 files changed:
ChangeLog
libltdl/Makefile.am
libltdl/configure.in
libltdl/ltdl.c
libltdl/ltdl.h
ltmain.in
mdemo/main.c
mdemo/modules/Makefile.am
mdemo/modules/foo1.c
mdemo/modules/foo2.c
mdemo/modules/libfoo1.sym
mdemo/modules/libfoo2.sym
tests/mdemo-exec.test
tests/mdemo-inst.test

index b402c54beb073c8c2567be8303697975dda3aa39..e410affafaca8d5748396caeb1deef6caf24b95e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+1998-11-22  Thomas Tanner  <tanner@gmx.de>
+
+       * libltdl: added support for .la files, LGPL license,
+       K&R compatibility, some API changes and bugfixes
+       * ltmain.in: renamed -module flag (for compiling) to -force-static,
+       define -DSTATIC when compiling static .o files,
+       do not include directories in dld_preloaded_symbols
+       * mdemo: modified mdemo to work with the new libltdl
+       * tests/mdemo-exec.test, tests/mdemo-inst.test: use .la files
+       
 1998-11-21  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * libltdl/ltdl.c: replace NULL with 0, so that we don't depend on
index c849bcf1383ddfaa76227950187eb36df9947354..480e92493a6f338909684e282c376fa5301d6214 100644 (file)
@@ -5,7 +5,7 @@
 # level Makefile.
 AUTOMAKE_OPTIONS = no-dependencies foreign
 
-CFLAGS = -module
+CFLAGS = -force-static
 
 EXTRA_DIST = acinclude.m4
 
index 4d160aa4db171a0ca52fd37518f396f76b6b724d..60049e8b2eb2f8169d78de1a772bfa194d634878 100644 (file)
@@ -5,7 +5,9 @@ AM_INIT_AUTOMAKE(libltdl,1.0)
 AC_PROG_CC
 AM_PROG_LIBTOOL
 
-AC_CHECK_HEADERS(string.h dlfcn.h dl.h)
+AC_HEADER_STDC
+AC_CHECK_HEADERS(malloc.h dlfcn.h dl.h)
+AC_CHECK_FUNCS(strdup)
 
 LIBADD_DL=
 AC_CHECK_FUNCS(dlopen, AC_DEFINE(HAVE_LIBDL),
@@ -17,5 +19,35 @@ AC_CHECK_FUNCS(dlopen, AC_DEFINE(HAVE_LIBDL),
 )
 AC_SUBST(LIBADD_DL)
 
+AC_MSG_CHECKING(for underscore before symbols)
+AC_CACHE_VAL(libltdl_cv_uscore,[
+  echo "main(){int i=1;} fnord(){int i=23; int ltuae=42;}" > conftest.c
+  ${CC} conftest.c > /dev/null
+  if (nm a.out | grep _fnord) > /dev/null; then
+    libltdl_cv_uscore=yes
+  else
+    libltdl_cv_uscore=no
+  fi])
+AC_MSG_RESULT($libltdl_cv_uscore)
+rm -f conftest.c a.out
+
+if test $libltdl_cv_uscore = yes; then
+  if test $ac_cv_func_dlopen = yes -o $ac_cv_lib_dl_dlopen = yes ; then
+       AC_MSG_CHECKING(whether we have to add an underscore for dlsym)
+       AC_CACHE_VAL(libltdl_cv_need_uscore,AC_TRY_RUN([
+#include <dlfcn.h>
+#include <stdio.h>
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,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 AC_DEFINE(NEED_USCORE)],
+       libltdl_cv_need_uscore=no))
+
+        AC_MSG_RESULT($libltdl_cv_need_uscore)
+  fi
+fi
+
 dnl Output the makefile
 AC_OUTPUT(Makefile)
index 3d7841bd9014c87ecc8b0ae99101741e09005209..27f7878c72f8b3749ace59258e83bfe7acdea525 100644 (file)
@@ -2,20 +2,22 @@
    Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
    This file is part of GNU Libtool.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
+This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-USA. */
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free
+Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define _LTDL_COMPILE_
 
 #include "ltdl.h"
 
@@ -23,7 +25,35 @@ USA. */
 #include <string.h>
 #endif
 
-#ifdef LT_RENAME
+#include <stdio.h>
+
+#ifndef HAVE_STRDUP
+
+static char *
+strdup(const char *str)
+{
+       char *tmp;
+
+       if (!str)
+               return str;
+       tmp = malloc(strlen(str)+1);
+       if (tmp)
+               strcpy(tmp, str);
+       return tmp;
+}
+
+#endif
+
+typedef        struct lt_dlhandle_t {
+       struct lt_dlhandle_t *next;
+       char    *filename;      /* file name */
+       char    *name;          /* module name */
+       int     usage;          /* usage */
+       void    *handle;        /* system handle */
+       void    *sys;           /* system specific data */
+} lt_dlhandle_t;
+
+#ifdef STATIC
 
 /* emulate dynamic linking using dld_preloaded_symbols */
 
@@ -35,13 +65,20 @@ struct dld_symlist
 
 extern struct dld_symlist dld_preloaded_symbols[];
 
-static void
-sys_dlinit (void)
+static int
+sys_dlinit ()       
 {
+       return 0;
 }
 
-static lt_dlhandle
-sys_dlopen (char *filename)
+static int
+sys_dlexit ()       
+{
+       return 0;
+}
+
+static int
+sys_dlopen (handle, filename)  lt_dlhandle handle; const char *filename;
 {
        struct dld_symlist *s = dld_preloaded_symbols;
 
@@ -51,29 +88,28 @@ sys_dlopen (char *filename)
                s++;
        }
        if (!s->name)
-               return 0;
-       return (void*)s;
+               return 1;
+       handle->handle = s;
+       return 0;
 }
 
-static void
-sys_dlclose (lt_dlhandle handle)
+static int
+sys_dlclose (handle)  lt_dlhandle handle;
 {
+       return 0;
 }
 
 static void *
-sys_dlsym (lt_dlhandle handle, char *symbol)
+sys_dlsym (handle, symbol)  lt_dlhandle handle; char *symbol;
 {
-       struct dld_symlist *s = (struct dld_symlist*)handle;
+       struct dld_symlist *s = (struct dld_symlist*)(handle->handle);
 
        if (!s)
                return 0;
        s++;
        while (s->address) {
-               if (!strncmp(s->name, "ltexp_", 6)) {
-                       char    *p = strstr(s->name, "___");
-                       if (p && !strcmp(&p[3], symbol))
-                               return s->address;
-               }
+               if (strcmp(s->name, symbol) == 0)
+                       return s->address;
                s++;
        }
        return 0;
@@ -88,45 +124,45 @@ sys_dlsym (lt_dlhandle handle, char *symbol)
 #include <dlfcn.h>
 #endif
 
-#ifdef RTLD_LAZY       /* Solaris 2. */
+#ifdef RTLD_LAZY       
 #  define DLOPEN_MODE  RTLD_LAZY
 #else
 #ifdef DL_LAZY
 #  define DLOPEN_MODE  DL_LAZY
 #else
-#  define DLOPEN_MODE  1       /* Thats what it says in the man page. */
+#  define DLOPEN_MODE  1
 #endif
 #endif
 
-static void
-sys_dlinit (void)
+static int
+sys_dlinit ()       
 {
+       return 0;
 }
 
-static lt_dlhandle
-sys_dlopen (char *filename)
+static int
+sys_dlexit ()       
 {
-       return dlopen(filename, DLOPEN_MODE);
+       return 0;
 }
 
-static void
-sys_dlclose (lt_dlhandle handle)
+static int
+sys_dlopen (handle, filename)  lt_dlhandle handle; const char *filename;
+{
+       handle->handle = dlopen(filename, DLOPEN_MODE);
+       return !(handle->handle);
+}
+
+static int
+sys_dlclose (handle)  lt_dlhandle handle;
 {
-       dlclose(handle);
+       return dlclose(handle->handle);
 }
 
 static void *
-sys_dlsym (lt_dlhandle handle, char *symbol)
+sys_dlsym (handle, symbol)  lt_dlhandle handle; char *symbol;
 {
-#ifdef __OpenBSD__
-       char    sym[128];
-       
-       strcpy(sym, "_");
-       strcat(sym, symbol);    /* prefix symbol with leading underscore */
-       return dlsym(handle, sym);
-#else
-       return dlsym(handle, symbol);
-#endif
+       return dlsym(handle->handle, symbol);
 }
 
 #else
@@ -138,32 +174,41 @@ sys_dlsym (lt_dlhandle handle, char *symbol)
 #include <dl.h>
 #endif
 
-static void
-sys_dlinit (void)
+static int
+sys_dlinit ()       
+{
+       return 0;
+}
+
+static int
+sys_dlexit ()       
 {
+       return 0;
 }
 
-static lt_dlhandle
-sys_dlopen (char *filename)
+static int
+sys_dlopen (handle, filename)  lt_dlhandle handle; const char *filename;
 {
        /* Probably too much BIND_* flags */
-       return shl_load (filename, BIND_IMMEDIATE || BIND_FIRST ||
+       handle->handle = shl_load (filename, BIND_IMMEDIATE || BIND_FIRST ||
                BIND_TOGETHER || BIND_VERBOSE || DYNAMIC_PATH, 0L);
+       return !(handle->handle);
 }
 
-static void
-sys_dlclose (lt_dlhandle handle)
+static int
+sys_dlclose (handle)  lt_dlhandle handle;
 {
-       shl_unload((shl_t) handle);
+       shl_unload((shl_t) (handle->handle));
+       return 0;
 }
 
 static void *
-sys_dlsym (lt_dlhandle handle, char *symbol)
+sys_dlsym (handle, symbol)  lt_dlhandle handle; char *symbol;
 {
        int status, i;
        struct shl_symbol *sym;
 
-       status = shl_getsymbols((shl_t) handle, TYPE_PROCEDURE,
+       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)
@@ -176,29 +221,38 @@ sys_dlsym (lt_dlhandle handle, char *symbol)
 
 /* dynamic linking with dld */
 
-static void
-sys_dlinit (void)
+static int
+sys_dlinit ()       
 {
+       return 0;
 }
 
-static lt_dlhandle
-sys_dlopen (char *filename)
+static int
+sys_dlexit ()       
 {
-       if (dld_link (filename))
-               return 0;
-       return filename;
+       return 0;
 }
 
-static void
-sys_dlclose (lt_dlhandle handle)
+static int
+sys_dlopen (handle, filename)  lt_dlhandle handle; const char *filename;
 {
-       dld_unlink_by_file ((char*)handle, 1);
+       if (dld_link(filename))
+               return 1;
+       handle->handle = filename;
+       return 0;
+}
+
+static int
+sys_dlclose (handle)  lt_dlhandle handle;
+{
+       dld_unlink_by_file((char*)(handle->handle), 1);
+       return 0;
 }
 
 static void *
-sys_dlsym (lt_dlhandle handle, char *symbol)
+sys_dlsym (handle, symbol)  lt_dlhandle handle; char *symbol;
 {
-       return dld_get_func (symbol);
+       return dld_get_func(symbol);
 }
 
 #else
@@ -208,51 +262,68 @@ sys_dlsym (lt_dlhandle handle, char *symbol)
 
 #include <windows.h> 
 
-static void
-sys_dlinit (void)
+static int
+sys_dlinit ()       
 {
+       return 0;
 }
 
-static lt_dlhandle
-sys_dlopen (char *filename)
+static int
+sys_dlexit ()       
 {
-       return LoadLibrary(filename);
+       return 0;
 }
 
-static void
-sys_dlclose (lt_dlhandle handle)
+static int
+sys_dlopen (handle, filename)  lt_dlhandle handle; const char *filename;
 {
-       FreeLibrary(handle);
+       handle->handle = LoadLibrary(filename);
+       return !(handle->handle);
+}
+
+static int
+sys_dlclose (handle)  lt_dlhandle handle;
+{
+       FreeLibrary(handle->handle);
+       return 0;
 }
 
 static void *
-sys_dlsym (lt_dlhandle handle, char *symbol)
+sys_dlsym (handle, symbol)  lt_dlhandle handle; char *symbol;
 {
-       return GetProcAddress(handle, symbol);
+       return GetProcAddress(handle->handle, symbol);
 }
 
 #else 
 
 /* no dynamic linking available */
 
-static void
-sys_dlinit (void)
+static int
+sys_dlinit ()       
 {
+       return 1;       /* dlopen not supported */
 }
 
-static lt_dlhandle
-sys_dlopen (char *filename)
+static int
+sys_dlexit ()       
 {
        return 0;
 }
 
-static void
-sys_dlclose (lt_dlhandle handle)
+static int
+sys_dlopen (handle, filename)  lt_dlhandle handle; const char *filename;
+{
+       return 1;       /* always report an error */
+}
+
+static int
+sys_dlclose (handle)  lt_dlhandle handle;
 {
+       return 0;
 }
 
 static void *
-sys_dlsym (lt_dlhandle handle, char *symbol)
+sys_dlsym (handle, symbol)  lt_dlhandle handle; char *symbol;
 {
        return 0;
 }
@@ -263,27 +334,220 @@ sys_dlsym (lt_dlhandle handle, char *symbol)
 #endif
 #endif
 
-void
-lt_dlinit (void)
+static lt_dlhandle handles;
+static int initialized = 0;
+
+int
+lt_dlinit ()       
 {
-       sys_dlinit();
+       if (initialized) {      /* Initialize only at first call. */
+               initialized++;
+               return 0;
+       }
+       handles = 0;
+       if (sys_dlinit())
+               return 1;
+       initialized = 1;
+       return 0;
 }
 
-lt_dlhandle
-lt_dlopen (char *filename)
+int
+lt_dlexit ()       
 {
-       return sys_dlopen(filename);
+       int     error;
+       
+       if (!initialized)
+               return 1;       /* already deinitialized */     
+       if (initialized != 1) { /* deinitialize only at last call. */
+               initialized--;
+               return 0;
+       }
+       /* close all modules */
+       error = 0;
+       while (handles)
+               if (lt_dlclose(handles))
+                       error = 1;
+       initialized = 0;
+       if (sys_dlexit())
+               error = 1;
+       return error;
 }
 
+static void
+trim (char *dest, const char *s)
+{
+       char *i = rindex(s, '\'');
+       int len = strlen(s);
+
+       if (len > 3 && s[0] == '\'') {
+               strncpy(dest, &s[1], (i - s) - 1);
+               dest[len-3] = '\0';
+       } else
+               *dest = '\0';
+}
 
-void
-lt_dlclose (lt_dlhandle handle)
+lt_dlhandle
+lt_dlopen (filename)  const char *filename;
 {
-       sys_dlclose(handle);
+       lt_dlhandle handle, cur;
+       FILE    *file;
+       char    tmp[1024], dir[512];
+       char    *basename, *ext;
+       
+       /* check whether the module was already opened */
+       cur = handles;
+       while (cur && strcmp(cur->filename, filename))
+               cur = cur->next;
+       if (cur) {
+               cur->usage++;
+               return cur;
+       }
+
+       handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
+       if (!handle)
+               return 0;
+       basename = rindex(filename, '/'); /* FIXME: portable? */
+       if (basename)
+               basename++;
+       strncpy(dir, filename, basename - filename);
+       dir[basename - filename] = '\0';
+       /* check whether we open a libtool module (.la extension) */
+       ext = rindex(basename, '.');
+       if (ext && strcmp(ext, ".la") == 0) {
+               char    dlname[256], libdir[512], deps[512];
+               char    fullname[512];
+       
+               file = fopen(filename, "r"); /* FIXME: portable? */
+               if (!file) {
+                       free(handle);
+                       return 0;
+               }
+               while (!feof(file)) {
+                       if (!fgets(tmp, 1024, file))
+                               break;
+                       if (strncmp(tmp, "libdir=", 7) == 0)
+                               trim(libdir, &tmp[7]);
+                       else
+                       if (strncmp(tmp, "dependency_libs=", 16) == 0)
+                               trim(deps, &tmp[16]);
+                       else
+#ifdef STATIC
+                       if (strncmp(tmp, "old_library=", 12) == 0)
+                               trim(dlname, &tmp[12]);
+#else
+                       if (strncmp(tmp, "dlname=", 7) == 0)
+                               trim(dlname, &tmp[7]);
+#endif
+               }
+               fclose(file);
+               if (!strlen(dlname)) {  /* filename not found */
+                       free(handle);
+                       return 0;
+               }
+               /* search the module */
+#ifdef STATIC
+               if (sys_dlopen(handle, dlname)) {
+                       free(handle);
+                       return 0;
+               }
+               handle->filename = strdup(dlname);
+#else
+               strcpy(fullname, libdir);
+               strcat(fullname, "/");
+               strcat(fullname, dlname);
+               if (sys_dlopen(handle, fullname)) {
+                       strcpy(fullname, dir);
+                       strcat(fullname, dlname);
+                       if (sys_dlopen(handle, fullname)) {
+                               strcpy(fullname, dir);
+                               strcat(fullname, ".libs/");
+                               strcat(fullname, dlname);
+                               if (sys_dlopen(handle, fullname)) {
+                                       free(handle);
+                                       return 0;
+                               }
+                       }
+               }       
+               handle->filename = strdup(fullname);
+#endif
+               /* extract the module name from the file name */
+               strcpy(tmp, basename);
+               tmp[ext - basename] = '\0';
+               handle->name = strdup(tmp);
+       } else {
+               /* not a libtool module */
+               if (sys_dlopen(handle, filename)) {
+                       free(handle);
+                       return 0;
+               }
+               handle->filename = strdup(filename);
+               handle->name = 0;
+       }
+       handle->usage = 1;
+       handle->next = handles;
+       handles = handle;
+       return handle;
+}
+
+int
+lt_dlclose (handle)  lt_dlhandle handle;
+{
+       lt_dlhandle cur, last;
+       
+       /* check whether the handle is valid */
+       last = cur = handles;
+       while (cur && handle != cur) {
+               last = cur;
+               cur = cur->next;
+       }
+       if (!cur)       
+               return 1; /* invalid handle */
+       handle->usage--;
+       if (!handle->usage) {
+               int     error;
+       
+               if (handle != handles)
+                       last->next = handle->next;
+               else
+                       handles = handle->next;
+               error = sys_dlclose(handle);
+               free(handle->filename);
+               if (handle->name)
+                       free(handle->name);
+               free(handle);
+               return error;
+       }
+       return 0;
 }
 
 void *
-lt_dlsym (lt_dlhandle handle, char *symbol)
+lt_dlsym (handle, symbol)  lt_dlhandle handle; char *symbol;
 {
+       char    sym[128];
+       void    *address;
+
+       if (handle->name) {     /* libtool module */
+#ifdef NEED_USCORE
+               /* prefix symbol with leading underscore */
+               strcpy(sym, "_");
+               strcat(sym, handle->name);
+#else
+               strcpy(sym, handle->name);
+#endif
+               strcat(sym, "_LTX_");
+               strcat(sym, symbol);
+               /* try "modulename_LTX_symbol" */
+               address = sys_dlsym(handle, sym);
+               if (address)
+                       return address;
+       }
+       /* otherwise try "symbol" */
+#ifdef NEED_USCORE
+       /* prefix symbol with leading underscore */
+       strcpy(sym, "_");
+       strcat(sym, symbol);
+       return sys_dlsym(handle, sym);
+#else
        return sys_dlsym(handle, symbol);
+#endif
 }
index b738f7d865046f3db38fd9114f51032a61c3d8b9..2aa3a006b8bdab7b3996b112b29c5f73313151ad 100644 (file)
@@ -2,20 +2,20 @@
    Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
    This file is part of GNU Libtool.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
+This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-USA. */
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free
+Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
 
 /* Only include this header file once. */
 #ifndef _LTDL_H_
@@ -44,12 +44,17 @@ USA. */
 # define __P(protos) ()
 #endif
 
+#ifdef _LTDL_COMPILE_
+typedef        struct lt_dlhandle_t *lt_dlhandle;
+#else
 typedef        void *lt_dlhandle;
+#endif
 
 __BEGIN_DECLS
-void           lt_dlinit __P((void));
-lt_dlhandle    lt_dlopen __P((char *name));
-void           lt_dlclose __P((lt_dlhandle handle));
+int            lt_dlinit __P((void));
+int            lt_dlexit __P((void));
+lt_dlhandle    lt_dlopen __P((const char *filename));
+int            lt_dlclose __P((lt_dlhandle handle));
 void           *lt_dlsym __P((lt_dlhandle handle, char *name));
 __END_DECLS
 
index edb203bb11226bcd5a2c1679e807c6843ffd1b9f..7f34693c7c72d6820945f0c819cc4dc30f59c9f3 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -262,7 +262,7 @@ if test -z "$show_help"; then
     lastarg=
     srcfile="$nonopt"
     suppress_output=
-    module=no
+    force_static=no
 
     user_target=no
     for arg
@@ -277,8 +277,8 @@ if test -z "$show_help"; then
         user_target=next
        ;;
 
-      -module)
-        module=yes
+      -force-static)
+        force_static=yes
         continue
         ;;
        
@@ -480,9 +480,9 @@ compiler."
        fi
       fi
 
-      # If we have no pic_flag and do not compile a module
+      # If we have no pic_flag and do not have -force-static
       # then copy the object into place and finish.
-      if test -z "$pic_flag" && test "$module" = no; then
+      if test -z "$pic_flag" && test "$force_static" = no; then
         $show "$LN_S $libobj $obj"
         if $run $LN_S $libobj $obj; then
          exit 0
@@ -499,8 +499,7 @@ compiler."
 
     # Only build a position-dependent object if we build old libraries.
     if test "$build_old_libs" = yes; then
-      command="$base_compile $srcfile"
-      test "$module" = yes && command="$command -DLT_RENAME"
+      command="$base_compile -DSTATIC $srcfile"
       if test "$compiler_c_o" = yes; then
         command="$command -o $obj"
         output_obj="$obj"
@@ -1845,8 +1844,9 @@ dld_preloaded_symbols[] =
             fi
 
             for arg in $dlprefiles; do
+             name=`basename $arg`
               echo >> "$objdir/$dlsyms" "\
-  {\"$arg\", (__ptr_t) 0},"
+  {\"$name\", (__ptr_t) 0},"
              eval "$NM $arg | $global_symbol_pipe > '$nlist'"
 
              if test -f "$nlist"; then
index 7157e51ac2254d5766779a8cf215daec4b4b5b3d..e6df0553fd8217ae8a89374a97aab17a9ce77ed1 100644 (file)
@@ -87,9 +87,15 @@ main (int argc, char **argv)
     fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
   }
 
-  lt_dlinit();
+  if (lt_dlinit() != 0) {
+    fprintf (stderr, "dlopen not supported\n");
+    return 1;
+  }
+
   for (i = 1; i < argc; i++)
     if (test_dl(argv[i]))
        return 1;
+
+  lt_dlexit();
   return 0;
 }
index 22cff523d1e01fd894b5604e4729e7a90dc1eac2..87bb3f41caf818b7f660c51087386450afd52e1d 100644 (file)
@@ -5,8 +5,6 @@
 # level Makefile.
 AUTOMAKE_OPTIONS = no-dependencies foreign
 
-CFLAGS = @CFLAGS@ -module
-
 INCLUDES = -I$(srcdir)/../../libltdl
 
 lib_LTLIBRARIES = libfoo1.la libfoo2.la
index c2d579c226c1a73d4808c315a3b44984368a4a62..d6e839982d6dbc9d50cdae65aea7edd3146fb984 100644 (file)
@@ -21,12 +21,9 @@ USA. */
 #include <stdio.h>
 #include <math.h>
 
-#ifndef PIC /* fixme */
-/*#ifdef LT_RENAME */
-#define nothing ltexp_foo1___nothing
-#define foo1   ltexp_foo1___foo1
-#define hello  ltexp_foo1___hello
-#endif
+#define nothing libfoo1_LTX_nothing
+#define foo1   libfoo1_LTX_foo1
+#define hello  libfoo1_LTX_hello
 
 /* Give a global variable definition. */
 int nothing;
index e701d22c7d74bf32e4ed3624ceb4d08bf71d004d..f03b06f3363ebda33251cc834d7cb20785e39c7d 100644 (file)
@@ -21,12 +21,9 @@ USA. */
 #include <stdio.h>
 #include <math.h>
 
-#ifndef PIC /* fixme */
-/*#ifdef LT_RENAME */
-#define nothing ltexp_foo2___nothing
-#define foo2   ltexp_foo2___foo2
-#define hello  ltexp_foo2___hello
-#endif
+#define nothing libfoo2_LTX_nothing
+#define foo2   libfoo2_LTX_foo2
+#define hello  libfoo2_LTX_hello
 
 /* Give a global variable definition. */
 int nothing;
index 3f9544a5d23ae19bc00331e4663649840eda8953..c3f2e67db94661fe4da2034b97e07f8df67d3f6d 100644 (file)
@@ -1,3 +1,3 @@
-nothing
-hello
-foo1
+libfoo1_LTX_nothing
+libfoo1_LTX_foo1
+libfoo1_LTX_hello
index 3d8cd9479f4ed27a00603365b2ab35dd577d36b4..a305fbe6341ecb598ae7cddfb9e4e613bc3f0712 100644 (file)
@@ -1,3 +1,3 @@
-nothing
-hello
-foo2
+libfoo2_LTX_nothing
+libfoo2_LTX_foo2
+libfoo2_LTX_hello
index 0aa99f19e7cb647b207981f8784f26683a33a174..c9f0a43b92be4879eb102e0d1dd3ca24c78bd231 100755 (executable)
@@ -19,19 +19,14 @@ fi
 # Check to see if the programs really run.
 echo "Executing uninstalled programs in ../mdemo"
 
-old_library1=`sed -n -e "s/^old_library='\(.*\)'/\1/p" ../mdemo/modules/libfoo1.la`
-old_library2=`sed -n -e "s/^old_library='\(.*\)'/\1/p" ../mdemo/modules/libfoo2.la`
-dlname1=`sed -n -e "s/^dlname='\(.*\)'/\1/p" ../mdemo/modules/libfoo1.la`
-dlname2=`sed -n -e "s/^dlname='\(.*\)'/\1/p" ../mdemo/modules/libfoo2.la`
-
 status=0
-if ../mdemo/hell.debug modules/.libs/$old_library1 modules/.libs/$old_library2; then :
+if ../mdemo/hell.debug ../mdemo/modules/libfoo1.la ../mdemo/modules/libfoo2.la; then :
 else
   echo "$0: cannot execute ../mdemo/hell.debug" 1>&2
   status=1
 fi
 
-if ../mdemo/hell ../mdemo/modules/.libs/$dlname1 ../mdemo/modules/.libs/$dlname2; then :
+if ../mdemo/hell ../mdemo/modules/libfoo1.la ../mdemo/modules/libfoo2.la; then :
 else
   echo "$0: cannot execute ../mdemo/hell" 1>&2
   status=1
index 2c0fc9442c945a6f737adbdfec1b567a6ef715b4..eb850b2c7491f688a8ec74fab06e0bfad2b704be 100755 (executable)
@@ -35,19 +35,14 @@ $make install || exit 1
 
 echo "= Executing installed programs"
 
-old_library1=`sed -n -e "s/^old_library='\(.*\)'/\1/p" ../mdemo/modules/libfoo1.la`
-old_library2=`sed -n -e "s/^old_library='\(.*\)'/\1/p" ../mdemo/modules/libfoo2.la`
-dlname1=`sed -n -e "s/^dlname='\(.*\)'/\1/p" ../mdemo/modules/libfoo1.la`
-dlname2=`sed -n -e "s/^dlname='\(.*\)'/\1/p" ../mdemo/modules/libfoo2.la`
-
 status=0
-if $prefix/bin/hell.debug modules/.libs/$old_library1 modules/.libs/$old_library2; then :
+if $prefix/bin/hell.debug $prefix/lib/libfoo1.la $prefix/lib/libfoo2.la; then :
 else
   echo "$0: cannot execute $prefix/bin/hell.debug" 1>&2
   status=1
 fi
 
-if $prefix/bin/hell $prefix/lib/$dlname1 $prefix/lib/$dlname2; then :
+if $prefix/bin/hell $prefix/lib/libfoo1.la $prefix/lib/libfoo2.la; then :
 else
   echo "$0: cannot execute $prefix/bin/hell" 1>&2