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-default-info-directories
54 dirlist (char-to-string directory-sep-char))))
55 '(("usr" "local" "info")
57 ("usr" "local" "share" "info")
58 ("usr" "share" "info")))
59 "Directories appended to the end of the info path by default.")
61 (defun paths-find-site-lisp-directory (roots)
62 "Find the site Lisp directory of the XEmacs hierarchy."
63 (paths-find-site-directory roots "site-lisp"
65 configure-site-directory))
67 (defun paths-find-site-module-directory (roots)
68 "Find the site modules directory of the XEmacs hierarchy."
69 (paths-find-site-directory roots "site-modules"
71 configure-site-module-directory))
73 (defun paths-find-lisp-directory (roots)
74 "Find the main Lisp directory of the XEmacs hierarchy."
75 (paths-find-version-directory roots "lisp"
77 configure-lisp-directory))
79 (defun paths-find-mule-lisp-directory (roots &optional lisp-directory)
80 "Find the Mule Lisp directory of the XEmacs hierarchy."
84 (file-name-as-directory
85 (paths-construct-path (list lisp-directory "mule")))))
86 (if (paths-file-readable-directory-p guess)
88 (paths-find-version-directory roots "mule-lisp"
90 configure-mule-lisp-directory)))))
92 (defun paths-find-module-directory (roots)
93 "Find the main modules directory of the XEmacs hierarchy."
94 (paths-find-architecture-directory roots "modules"
95 nil configure-module-directory))
97 (defun paths-construct-load-path
98 (roots early-package-load-path late-package-load-path last-package-load-path
100 &optional site-lisp-directory mule-lisp-directory)
101 "Construct the load path."
102 (let* ((envvar-value (getenv "EMACSLOADPATH"))
105 (paths-decode-directory-path envvar-value 'drop-empties)))
107 (and site-lisp-directory
108 (paths-find-recursive-load-path (list site-lisp-directory)
109 paths-site-load-path-depth)))
111 (and mule-lisp-directory
112 (paths-find-recursive-load-path (list mule-lisp-directory)
113 paths-mule-load-path-depth)))
116 (paths-find-recursive-load-path (list lisp-directory)
117 paths-core-load-path-depth))))
118 (append env-load-path
119 early-package-load-path
121 late-package-load-path
124 last-package-load-path)))
126 (defun paths-construct-module-load-path
127 (root module-directory &optional site-module-directory)
128 "Construct the modules load path."
129 (let* ((envvar-value (getenv "EMACSMODULEPATH"))
132 (paths-decode-directory-path envvar-value 'drop-empties)))
133 (site-module-load-path
134 (and site-module-directory
135 (paths-find-recursive-load-path (list site-module-directory)
136 paths-site-load-path-depth)))
138 (and module-directory
139 (paths-find-recursive-load-path (list module-directory)
140 paths-core-load-path-depth))))
141 (append env-module-path
142 site-module-load-path
145 (defun paths-construct-info-path (roots early-packages late-packages last-packages)
146 "Construct the info path."
147 (let ((info-path-envval (getenv "INFOPATH")))
150 (let ((info-directory
151 (paths-find-version-directory roots "info"
153 configure-info-directory)))
155 (list info-directory)))
156 (packages-find-package-info-path early-packages)
157 (packages-find-package-info-path late-packages)
158 (packages-find-package-info-path last-packages)
159 (and info-path-envval
160 (paths-decode-directory-path info-path-envval 'drop-empties)))
161 (and (null info-path-envval)
163 (paths-directories-which-exist configure-info-path)
164 (paths-directories-which-exist paths-default-info-directories))))))
166 (defun paths-find-doc-directory (roots)
167 "Find the documentation directory."
168 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory))
170 (defun paths-find-exec-directory (roots)
171 "Find the binary directory."
172 (paths-find-architecture-directory roots "lib-src"
173 nil configure-exec-directory))
175 (defun paths-construct-exec-path (roots exec-directory
176 early-packages late-packages last-packages)
177 "Find the binary path."
179 (let ((path-envval (getenv "PATH")))
181 (paths-decode-directory-path path-envval 'drop-empties)))
182 (packages-find-package-exec-path early-packages)
183 (packages-find-package-exec-path late-packages)
184 (let ((emacspath-envval (getenv "EMACSPATH")))
185 (and emacspath-envval
186 (split-path emacspath-envval)))
188 (list exec-directory))
189 (packages-find-package-exec-path last-packages)))
191 (defun paths-find-data-directory (roots)
192 "Find the data directory."
193 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory))
195 (defun paths-construct-data-directory-list (data-directory
196 early-packages late-packages last-packages)
197 "Find the data path."
199 (packages-find-package-data-path early-packages)
200 (packages-find-package-data-path late-packages)
201 (list data-directory)
202 (packages-find-package-data-path last-packages)))
204 ;;; setup-paths.el ends here