summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-08-06 13:15:29 +0200
committerAndy Wingo <wingo@pobox.com>2010-08-06 13:15:29 +0200
commitbc325e763f540048adc0e6375172af5cfc38742e (patch)
treeac775f9b9c5ee6320e875ca3086d2e80f9a9f0df
parentca290a89f3109f125f1eb6eeea066053d4b52e95 (diff)
downloadguile-bc325e763f540048adc0e6375172af5cfc38742e.tar.gz
%site-dir is specific to the effective version
* libguile/load.h: * libguile/load.c (scm_sys_global_site_dir): New API, is what %site-dir used to be. (scm_sys_site_dir): Changed to be a version-specific dir. (scm_init_load_path): Search the version-specific sitedir before the global one. * libguile/Makefile.am (libpath.h): Update SCM_SITE_DIR and SCM_GLOBAL_SITE_DIR, as appropriate.
-rw-r--r--libguile/Makefile.am3
-rw-r--r--libguile/load.c20
-rw-r--r--libguile/load.h3
3 files changed, 21 insertions, 5 deletions
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 9836aa1ad..d5826f858 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -620,7 +620,8 @@ libpath.h: $(srcdir)/Makefile.in $(top_builddir)/config.status
@echo '/* generated by Makefile */' > libpath.tmp
@echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
@echo '#define SCM_LIBRARY_DIR "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp
- @echo '#define SCM_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
+ @echo '#define SCM_SITE_DIR "$(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)"' >> libpath.tmp
+ @echo '#define SCM_GLOBAL_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
@echo '#define SCM_LIB_DIR "$(libdir)"' >> libpath.tmp
@echo '#define SCM_EXTENSIONS_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions"' >> libpath.tmp
@echo '#define SCM_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache"' >> libpath.tmp
diff --git a/libguile/load.c b/libguile/load.c
index 05667af36..7c06c9b09 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -167,8 +167,9 @@ SCM_DEFINE (scm_sys_library_dir, "%library-dir", 0,0,0,
#ifdef SCM_SITE_DIR
SCM_DEFINE (scm_sys_site_dir, "%site-dir", 0,0,0,
(),
- "Return the directory where the Guile site files are installed.\n"
- "E.g., may return \"/usr/share/guile/site\".")
+ "Return the directory where users should install Scheme code for use\n"
+ "with this version of Guile.\n\n"
+ "E.g., may return \"/usr/share/guile/site/" SCM_EFFECTIVE_VERSION "\".")
#define FUNC_NAME s_scm_sys_site_dir
{
return scm_from_locale_string (SCM_SITE_DIR);
@@ -176,6 +177,18 @@ SCM_DEFINE (scm_sys_site_dir, "%site-dir", 0,0,0,
#undef FUNC_NAME
#endif /* SCM_SITE_DIR */
+#ifdef SCM_GLOBAL_SITE_DIR
+SCM_DEFINE (scm_sys_global_site_dir, "%global-site-dir", 0,0,0,
+ (),
+ "Return the directory where users should install Scheme code for use\n"
+ "with all versions of Guile.\n\n"
+ "E.g., may return \"/usr/share/guile/site\".")
+#define FUNC_NAME s_scm_sys_global_site_dir
+{
+ return scm_from_locale_string (SCM_GLOBAL_SITE_DIR);
+}
+#undef FUNC_NAME
+#endif /* SCM_GLOBAL_SITE_DIR */
@@ -239,8 +252,9 @@ scm_init_load_path ()
else if (env)
path = scm_parse_path (scm_from_locale_string (env), path);
else
- path = scm_list_3 (scm_from_locale_string (SCM_LIBRARY_DIR),
+ path = scm_list_4 (scm_from_locale_string (SCM_LIBRARY_DIR),
scm_from_locale_string (SCM_SITE_DIR),
+ scm_from_locale_string (SCM_GLOBAL_SITE_DIR),
scm_from_locale_string (SCM_PKGDATA_DIR));
env = getenv ("GUILE_SYSTEM_COMPILED_PATH");
diff --git a/libguile/load.h b/libguile/load.h
index 0bff53cbd..d1afefbc0 100644
--- a/libguile/load.h
+++ b/libguile/load.h
@@ -3,7 +3,7 @@
#ifndef SCM_LOAD_H
#define SCM_LOAD_H
-/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -32,6 +32,7 @@ SCM_API SCM scm_c_primitive_load (const char *filename);
SCM_API SCM scm_sys_package_data_dir (void);
SCM_API SCM scm_sys_library_dir (void);
SCM_API SCM scm_sys_site_dir (void);
+SCM_API SCM scm_sys_global_site_dir (void);
SCM_API SCM scm_search_path (SCM path, SCM filename, SCM rest);
SCM_API SCM scm_sys_search_load_path (SCM filename);
SCM_API SCM scm_primitive_load_path (SCM filename_and_exception_on_not_found);