mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
Make sure we don't override the user's extension search path.
* libguile/dynl.c (augment_env): New function. (sysdep_dynl_init): Use it instead of `lt_dladdsearchdir'. * configure.ac: Define `SHARED_LIBRARY_PATH_VARIABLE'.
This commit is contained in:
parent
726788204f
commit
e66ff09adb
2 changed files with 42 additions and 4 deletions
|
@ -78,6 +78,10 @@ AC_PROG_LIBTOOL
|
||||||
|
|
||||||
AM_CONDITIONAL([HAVE_SHARED_LIBRARIES], [test "x$enable_shared" = "xyes"])
|
AM_CONDITIONAL([HAVE_SHARED_LIBRARIES], [test "x$enable_shared" = "xyes"])
|
||||||
|
|
||||||
|
AC_DEFINE_UNQUOTED([SHARED_LIBRARY_PATH_VARIABLE], ["$shlibpath_var"],
|
||||||
|
[Name of the environment variable that tells the dynamic linker where
|
||||||
|
to find shared libraries.])
|
||||||
|
|
||||||
dnl Check for libltdl.
|
dnl Check for libltdl.
|
||||||
AC_LIB_HAVE_LINKFLAGS([ltdl], [], [#include <ltdl.h>],
|
AC_LIB_HAVE_LINKFLAGS([ltdl], [], [#include <ltdl.h>],
|
||||||
[lt_dlopenext ("foo");])
|
[lt_dlopenext ("foo");])
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* dynl.c - dynamic linking
|
/* dynl.c - dynamic linking
|
||||||
*
|
*
|
||||||
* Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
|
* Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
|
||||||
* 2003, 2008, 2009, 2010 Free Software Foundation, Inc.
|
* 2003, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <alloca.h>
|
||||||
|
|
||||||
/* "dynl.c" dynamically link&load object files.
|
/* "dynl.c" dynamically link&load object files.
|
||||||
Author: Aubrey Jaffer
|
Author: Aubrey Jaffer
|
||||||
Modified for libguile by Marius Vollmer */
|
Modified for libguile by Marius Vollmer */
|
||||||
|
@ -44,6 +46,7 @@ maybe_drag_in_eprintf ()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -118,6 +121,30 @@ sysdep_dynl_value (const char *symb, void *handle, const char *subr)
|
||||||
return fptr;
|
return fptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Augment environment variable VARIABLE with VALUE, assuming VARIABLE
|
||||||
|
is a path kind of variable. */
|
||||||
|
static void
|
||||||
|
augment_env (const char *variable, const char *value)
|
||||||
|
{
|
||||||
|
const char *env;
|
||||||
|
|
||||||
|
env = getenv (variable);
|
||||||
|
if (env != NULL)
|
||||||
|
{
|
||||||
|
char *new_value;
|
||||||
|
static const char path_sep[] = { LT_PATHSEP_CHAR, 0 };
|
||||||
|
|
||||||
|
new_value = alloca (strlen (env) + strlen (value) + 2);
|
||||||
|
strcpy (new_value, env);
|
||||||
|
strcat (new_value, path_sep);
|
||||||
|
strcat (new_value, value);
|
||||||
|
|
||||||
|
setenv (variable, new_value, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
setenv (variable, value, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysdep_dynl_init ()
|
sysdep_dynl_init ()
|
||||||
{
|
{
|
||||||
|
@ -136,8 +163,15 @@ sysdep_dynl_init ()
|
||||||
lt_dladdsearchdir (env);
|
lt_dladdsearchdir (env);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lt_dladdsearchdir (SCM_LIB_DIR);
|
/* Add SCM_LIB_DIR and SCM_EXTENSIONS_DIR to the loader's search
|
||||||
lt_dladdsearchdir (SCM_EXTENSIONS_DIR);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue