]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* NEWS: improved support for BeOS and Cygwin
authorThomas Tanner <tanner@gmx.de>
Thu, 18 Mar 1999 17:40:51 +0000 (17:40 +0000)
committerThomas Tanner <tanner@gmx.de>
Thu, 18 Mar 1999 17:40:51 +0000 (17:40 +0000)
* 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: ignore -lm on BeOS and Cygwin, always ignore -lc

ChangeLog
NEWS
autogen
libltdl/ltdl.c
libtool.m4
ltconfig.in
ltmain.in

index 04b5ff7eebc8153f84a19951600a2701e384c772..be7645292411fa07ca6267bbaceb5b6b301b1d28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+1999-03-18  Thomas Tanner  <tanner@gmx.de>
+
+       * NEWS: improved support for BeOS and Cygwin
+       * 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: ignore -lm on BeOS and Cygwin, always ignore -lc
+         
 1999-03-17  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * ltconfig.in (hpux*, hardcode_minus_L): should be no, we have +b
diff --git a/NEWS b/NEWS
index caac526a7136a76a38e8e143d7bc2c401c9d2355..0f4f669e4ee8902d8cfed601d88cc61ae0333d85 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
 NEWS - list of user-visible changes between releases of GNU Libtool
 
 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
   and prefer uninstalled libraries to installed ones
diff --git a/autogen b/autogen
index 2a35dcac50783dad7e782fab0556e1245c5c2e5a..4cda5fe0eada30effab156aa6c66cfb044db02a1 100644 (file)
--- a/autogen
+++ b/autogen
@@ -14,7 +14,7 @@ aclocal
 automake --gnits --add-missing
 autoconf
 
-for sub in demo depdemo libltdl mdemo cdemo; do
+for sub in demo libltdl mdemo cdemo; do
   cd $sub
   rm -f acinclude.m4
   cp ../libtool.m4 acinclude.m4
index 571215638d1d8aa55d221dc26f2ade7533ddb4f4..221da12374218eb09b7f266fd3110c68ef7b786e 100644 (file)
@@ -82,6 +82,8 @@ static const char unknown_error[] = "unknown error";
 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";
@@ -204,10 +206,6 @@ strrchr(str, ch)
 # 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
@@ -259,7 +257,11 @@ dl_open (handle, filename)
 {
        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;
@@ -270,7 +272,11 @@ dl_close (handle)
        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;
@@ -284,7 +290,11 @@ dl_sym (handle, symbol)
        lt_ptr_t address = dlsym(handle->handle, symbol);
        
        if (!address)
+#if HAVE_DLERROR
                last_error = dlerror();
+#else
+               last_error = symbol_error;
+#endif
        return address;
 }
 
@@ -365,7 +375,7 @@ shl_open (handle, filename)
 {
        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;
@@ -376,7 +386,7 @@ shl_close (handle)
        lt_dlhandle handle;
 {
        if (shl_unload((shl_t) (handle->handle)) != 0) {
-               last_error = unknown_error;
+               last_error = cannot_close_error;
                return 1;
        }
        return 0;
@@ -391,7 +401,7 @@ shl_sym (handle, symbol)
 
        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;
@@ -438,7 +448,7 @@ dld_open (handle, filename)
                return 1;
        }
        if (dld_link(filename) != 0) {
-               last_error = unknown_error;
+               last_error = cannot_open_error;
                lt_dlfree(handle->handle);
                return 1;
        }
@@ -450,7 +460,7 @@ dld_close (handle)
        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);
@@ -465,7 +475,7 @@ dld_sym (handle, symbol)
        lt_ptr_t address = dld_get_func(symbol);
        
        if (!address)
-               last_error = unknown_error;
+               last_error = symbol_error;
        return address;
 }
 
@@ -504,7 +514,7 @@ wll_open (handle, filename)
 {
        handle->handle = LoadLibrary(filename);
        if (!handle->handle) {
-               last_error = unknown_error;
+               last_error = cannot_open_error;
                return 1;
        }
        return 0;
@@ -515,7 +525,7 @@ wll_close (handle)
        lt_dlhandle handle;
 {
        if (FreeLibrary(handle->handle) != 0) {
-               last_error = unknown_error;
+               last_error = cannot_close_error;
                return 1;
        }
        return 0;
@@ -529,7 +539,7 @@ wll_sym (handle, symbol)
        lt_ptr_t address = GetProcAddress(handle->handle, symbol);
        
        if (!address)
-               last_error = unknown_error;
+               last_error = symbol_error;
        return address;
 }
 
@@ -543,6 +553,84 @@ wll = { LTDL_TYPE_TOP, 0, wll_init, wll_exit,
 
 #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 {
@@ -1117,6 +1205,12 @@ lt_dlopen (filename)
                                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,
index f7661efd2d2159e94451b5516c943ce32cf91206..7b3dd4615a562b7bb67a45b9c822239938086c31 100644 (file)
@@ -568,9 +568,20 @@ AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
 ])
 
 # 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
index 1a91d7a3164b6dc012f4d78f58285c31b64c5fec..6766d1b9df0c4761afee3c976274aef202c0124d 100755 (executable)
@@ -1630,6 +1630,9 @@ beos*)
   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*)
@@ -1661,6 +1664,8 @@ cygwin* | mingw*)
   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*)
@@ -2139,54 +2144,6 @@ if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
   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
 
     
index 9411a90833d00058cc15e8520d2993b1ef5a713e..0294541d5952c82e35a68995092ffb86260c34f9 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -1010,6 +1010,17 @@ compiler."
        ;;
 
       -l*)
+       if test "$arg" = "-lm"; then
+         case "$host" in
+         *-*-cygwin* | *-*-beos*)
+           # Ignore -lm on Cygwin and BeOS
+           continue
+           ;;
+         esac  
+       elif test "$arg" = "-lc"; then
+         # Always ignore -lc
+         continue
+       fi
        deplibs="$deplibs $arg"
        ;;