guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

searching variation on sysdep_dynl_link


From: Bruce Korb
Subject: searching variation on sysdep_dynl_link
Date: Sat, 15 Sep 2012 10:33:25 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0

I confess to not having tested this because I don't have all the
required infrastructure to build.

autoreconf: running: /usr/bin/autoconf --force
configure.ac:58: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:77: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:78: error: possibly undefined macro: AC_PROG_LIBTOOL
configure.ac:898: error: possibly undefined macro: AM_GNU_GETTEXT

P.S. Would you please be kind enough to rename your bootstrap script to 
"bootstrap"?
Occasionally, folks ask me for help with their bootstrap scripts because I 
maintain
autogen.  Thanks.

diff --git a/libguile/dynl.c b/libguile/dynl.c
index 72305a4..ae1f795 100644
--- a/libguile/dynl.c
+++ b/libguile/dynl.c
@@ -81,7 +81,25 @@ sysdep_dynl_link (const char *fname, const char *subr)
   lt_dlhandle handle;

   if (fname != NULL)
-    handle = lt_dlopenext (fname);
+    {
+      char * buf;
+
+      handle = lt_dlopenext (fname);
+      if (handle == NULL)
+        do
+          {
+            static char const ext_dir[] = SCM_EXTENSIONS_DIR;
+            static char const lib_dir[] = SCM_LIB_DIR;
+            buf = alloca (max(sizeof (ext_dir), sizeof (lib_dir))
+                          + strlen (fname) + 1); // fault on failure
+            sprintf (buf, "%s/%s", lib_dir, fname);
+            handle = lt_dlopenext (buf);
+            if (handle != NULL)
+              break;
+            sprintf (buf, "%s/%s", ext_dir, fname);
+            handle = lt_dlopenext (buf);
+          } while (0);
+    }
   else
     /* Return a handle for the program as a whole.  */
     handle = lt_dlopen (NULL);
@@ -152,26 +170,15 @@ sysdep_dynl_init ()
   lt_dlinit ();

   env = getenv ("GUILE_SYSTEM_EXTENSIONS_PATH");
-  if (env && strcmp (env, "") == 0)
-    /* special-case interpret system-ltdl-path=="" as meaning no system path,
-       which is the case during the build */
-    ;
-  else if (env)
+  if (env == NULL)
+    return;
+
+  /* special-case interpret system-ltdl-path=="" as meaning no system path,
+     which is the case during the build */
+  if (*env != '\0')
     /* FIXME: should this be a colon-separated path? Or is the only point to
        allow the build system to turn off the installed extensions path? */
     lt_dladdsearchdir (env);
-  else
-    {
-      /* Add SCM_LIB_DIR and SCM_EXTENSIONS_DIR to the loader's search
-        path.  `lt_dladdsearchdir' and $LTDL_LIBRARY_PATH can't be used
-        for that because they are searched before the system-dependent
-        search path, which is the one `libtool --mode=execute -dlopen'
-        fiddles with (info "(libtool) Libltdl Interface").  See
-        <http://lists.gnu.org/archive/html/guile-devel/2010-11/msg00095.html>
-        for details.  */
-      augment_env (SHARED_LIBRARY_PATH_VARIABLE, SCM_LIB_DIR);
-      augment_env (SHARED_LIBRARY_PATH_VARIABLE, SCM_EXTENSIONS_DIR);
-    }
 }

 scm_t_bits scm_tc16_dynamic_obj;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]