1 ;;; setup-paths.el --- setup various XEmacs paths
3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc.
4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc.
5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
7 ;; Author: Mike Sperber <sperber@informatik.uni-tuebingen.de>
8 ;; Maintainer: XEmacs Development Team
9 ;; Keywords: internal, dumped
11 ;; This file is part of XEmacs.
13 ;; XEmacs is free software; you can redistribute it and/or modify it
14 ;; under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; XEmacs is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with XEmacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
28 ;;; Synched up with: Not in FSF.
32 ;; This file is dumped with XEmacs.
34 ;; This file describes and constructs the various paths into the
35 ;; XEmacs hierarchy from a global viewpoint.
37 ;; It requires find-paths.el and packages.el.
41 (defvar paths-core-load-path-depth 0
42 "Depth of load-path searches in core Lisp paths.")
44 (defvar paths-site-load-path-depth 1
45 "Depth of load-path searches in site Lisp paths.")
47 (defvar paths-mule-load-path-depth 0
48 "Depth of load-path searches in Mule Lisp paths.")
50 (defvar paths-utf-2000-load-path-depth 0
51 "Depth of load-path searches in UTF-2000 Lisp paths.")
53 (defvar paths-default-info-directories
57 dirlist (char-to-string directory-sep-char))))
58 '(("usr" "local" "info")
60 ("usr" "local" "share" "info")
61 ("usr" "share" "info")))
62 "Directories appended to the end of the info path by default.")
64 (defun paths-find-site-lisp-directory (roots)
65 "Find the site Lisp directory of the XEmacs hierarchy."
66 (paths-find-site-directory roots "site-lisp"
68 configure-site-directory))
70 (defun paths-find-site-module-directory (roots)
71 "Find the site modules directory of the XEmacs hierarchy."
72 (paths-find-site-directory roots "site-modules"
74 configure-site-module-directory))
76 (defun paths-find-lisp-directory (roots)
77 "Find the main Lisp directory of the XEmacs hierarchy."
78 (paths-find-version-directory roots "lisp"
80 configure-lisp-directory))
82 (defun paths-find-mule-lisp-directory (roots &optional lisp-directory)
83 "Find the Mule Lisp directory of the XEmacs hierarchy."
87 (file-name-as-directory
88 (paths-construct-path (list lisp-directory "mule")))))
89 (if (paths-file-readable-directory-p guess)
91 (paths-find-version-directory roots "mule-lisp"
93 configure-mule-lisp-directory)))))
95 (defun paths-find-utf-2000-lisp-directory (roots &optional lisp-directory)
96 "Find the UTF-2000 Lisp directory of the XEmacs hierarchy."
100 (file-name-as-directory
101 (paths-construct-path (list lisp-directory "utf-2000")))))
102 (if (paths-file-readable-directory-p guess)
104 (paths-find-version-directory roots "utf-2000-lisp"
106 configure-utf-2000-lisp-directory)))))
108 (defun paths-find-module-directory (roots)
109 "Find the main modules directory of the XEmacs hierarchy."
110 (paths-find-architecture-directory roots "modules"
111 nil configure-module-directory))
113 (defun paths-construct-load-path
114 (roots early-package-load-path late-package-load-path last-package-load-path
116 &optional site-lisp-directory mule-lisp-directory
117 utf-2000-lisp-directory)
118 "Construct the load path."
119 (let* ((envvar-value (getenv "EMACSLOADPATH"))
122 (paths-decode-directory-path envvar-value 'drop-empties)))
124 (and site-lisp-directory
125 (paths-find-recursive-load-path (list site-lisp-directory)
126 paths-site-load-path-depth)))
128 (and mule-lisp-directory
129 (paths-find-recursive-load-path (list mule-lisp-directory)
130 paths-mule-load-path-depth)))
131 (utf-2000-lisp-load-path
132 (and utf-2000-lisp-directory
133 (paths-find-recursive-load-path (list utf-2000-lisp-directory)
134 paths-utf-2000-load-path-depth)))
137 (paths-find-recursive-load-path (list lisp-directory)
138 paths-core-load-path-depth))))
139 (append env-load-path
140 early-package-load-path
142 late-package-load-path
143 utf-2000-lisp-load-path
146 last-package-load-path)))
148 (defun paths-construct-module-load-path
149 (root module-directory &optional site-module-directory)
150 "Construct the modules load path."
151 (let* ((envvar-value (getenv "EMACSMODULEPATH"))
154 (paths-decode-directory-path envvar-value 'drop-empties)))
155 (site-module-load-path
156 (and site-module-directory
157 (paths-find-recursive-load-path (list site-module-directory)
158 paths-site-load-path-depth)))
160 (and module-directory
161 (paths-find-recursive-load-path (list module-directory)
162 paths-core-load-path-depth))))
163 (append env-module-path
164 site-module-load-path
167 (defun paths-construct-info-path (roots early-packages late-packages last-packages)
168 "Construct the info path."
169 (let ((info-path-envval (getenv "INFOPATH")))
172 (let ((info-directory
173 (paths-find-version-directory roots "info"
175 configure-info-directory)))
177 (list info-directory)))
178 (packages-find-package-info-path early-packages)
179 (packages-find-package-info-path late-packages)
180 (packages-find-package-info-path last-packages)
181 (and info-path-envval
182 (paths-decode-directory-path info-path-envval 'drop-empties)))
183 (and (null info-path-envval)
185 (paths-directories-which-exist configure-info-path)
186 (paths-directories-which-exist paths-default-info-directories))))))
188 (defun paths-find-doc-directory (roots)
189 "Find the documentation directory."
190 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory))
192 (defun paths-find-exec-directory (roots)
193 "Find the binary directory."
194 (paths-find-architecture-directory roots "lib-src"
195 nil configure-exec-directory))
197 (defun paths-construct-exec-path (roots exec-directory
198 early-packages late-packages last-packages)
199 "Find the binary path."
201 (let ((path-envval (getenv "PATH")))
203 (paths-decode-directory-path path-envval 'drop-empties)))
204 (packages-find-package-exec-path early-packages)
205 (packages-find-package-exec-path late-packages)
206 (let ((emacspath-envval (getenv "EMACSPATH")))
207 (and emacspath-envval
208 (split-path emacspath-envval)))
210 (list exec-directory))
211 (packages-find-package-exec-path last-packages)))
213 (defun paths-find-data-directory (roots)
214 "Find the data directory."
215 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory))
217 (defun paths-construct-data-directory-list (data-directory
218 early-packages late-packages last-packages)
219 "Find the data path."
221 (packages-find-package-data-path early-packages)
222 (packages-find-package-data-path late-packages)
223 (list data-directory)
224 (packages-find-package-data-path last-packages)))
226 ;;; setup-paths.el ends here