This patch changes Guile to use a default search path relative to the location of the `guile' binary, allowing it to be relocated. diff --git a/libguile/load.c b/libguile/load.c --- a/libguile/load.c +++ b/libguile/load.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -334,6 +335,32 @@ scm_init_load_path () SCM cpath = SCM_EOL; #ifdef SCM_LIBRARY_DIR + char *program, *bin_dir, *prefix, *module_dir, *ccache_dir; + + /* Determine the source and compiled module directories at run-time, + relative to the executable's location. + + Note: Use /proc/self/exe instead of argv[0] because the latter is + not necessarily an absolute, nor a valid file name. */ + + program = scm_gc_malloc_pointerless (256, "string"); + readlink ("/proc/self/exe", program, 256); + + bin_dir = dirname (strdupa (program)); + + pref
aboutsummaryrefslogtreecommitdiff
cpath = scm_list_1 (scm_from_locale_string (ccache_dir)); } #endif /* SCM_LIBRARY_DIR */
AgeCommit message (Expand)Author