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 1
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-default-info-directories
51 dirlist (char-to-string directory-sep-char))))
52 '(("usr" "local" "info")
54 ("usr" "local" "share" "info")
55 ("usr" "share" "info")))
56 "Directories appended to the end of the info path by default.")
58 (defun paths-find-site-lisp-directory (roots)
59 "Find the site Lisp directory of the XEmacs hierarchy."
60 (paths-find-site-directory roots "site-lisp"
62 configure-site-directory))
64 (defun paths-find-site-module-directory (roots)
65 "Find the site modules directory of the XEmacs hierarchy."
66 (paths-find-site-directory roots "site-modules"
68 configure-site-module-directory))
70 (defun paths-find-lisp-directory (roots)
71 "Find the main Lisp directory of the XEmacs hierarchy."
72 (paths-find-version-directory roots "lisp"
74 configure-lisp-directory))
76 (defun paths-find-module-directory (roots)
77 "Find the main modules directory of the XEmacs hierarchy."
78 (paths-find-architecture-directory roots "modules"
79 nil configure-module-directory))
81 (defun paths-construct-load-path
82 (roots early-package-load-path late-package-load-path last-package-load-path
84 &optional site-lisp-directory)
85 "Construct the load path."
86 (let* ((envvar-value (getenv "EMACSLOADPATH"))
89 (paths-decode-directory-path envvar-value 'drop-empties)))
91 (and site-lisp-directory
92 (paths-find-recursive-load-path (list site-lisp-directory)
93 paths-site-load-path-depth)))
96 (paths-find-recursive-load-path (list lisp-directory)
97 paths-core-load-path-depth))))
99 early-package-load-path
101 late-package-load-path
103 last-package-load-path)))
105 (defun paths-construct-module-load-path
106 (root module-directory &optional site-module-directory)
107 "Construct the modules load path."
108 (let* ((envvar-value (getenv "EMACSMODULEPATH"))
111 (paths-decode-directory-path envvar-value 'drop-empties)))
112 (site-module-load-path
113 (and site-module-directory
114 (paths-find-recursive-load-path (list site-module-directory)
115 paths-site-load-path-depth)))
117 (and module-directory
118 (paths-find-recursive-load-path (list module-directory)
119 paths-core-load-path-depth))))
120 (append env-module-path
121 site-module-load-path
124 (defun paths-construct-info-path (roots early-packages late-packages last-packages)
125 "Construct the info path."
126 (let ((info-path-envval (getenv "INFOPATH")))
129 (let ((info-directory
130 (paths-find-version-directory roots "info"
132 configure-info-directory)))
134 (list info-directory)))
135 (packages-find-package-info-path early-packages)
136 (packages-find-package-info-path late-packages)
137 (packages-find-package-info-path last-packages)
138 (and info-path-envval
139 (paths-decode-directory-path info-path-envval 'drop-empties)))
140 (and (null info-path-envval)
142 (paths-directories-which-exist configure-info-path)
143 (paths-directories-which-exist paths-default-info-directories))))))
145 (defun paths-find-doc-directory (roots)
146 "Find the documentation directory."
147 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory))
149 (defun paths-find-exec-directory (roots)
150 "Find the binary directory."
151 (paths-find-architecture-directory roots "lib-src"
152 nil configure-exec-directory))
154 (defun paths-construct-exec-path (roots exec-directory
155 early-packages late-packages last-packages)
156 "Find the binary path."
158 (let ((path-envval (getenv "PATH")))
160 (paths-decode-directory-path path-envval 'drop-empties)))
161 (packages-find-package-exec-path early-packages)
162 (packages-find-package-exec-path late-packages)
163 (let ((emacspath-envval (getenv "EMACSPATH")))
164 (and emacspath-envval
165 (split-path emacspath-envval)))
167 (list exec-directory))
168 (packages-find-package-exec-path last-packages)))
170 (defun paths-find-data-directory (roots)
171 "Find the data directory."
172 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory))
174 (defun paths-construct-data-directory-list (data-directory
175 early-packages late-packages last-packages)
176 "Find the data path."
178 (packages-find-package-data-path early-packages)
179 (packages-find-package-data-path late-packages)
180 (list data-directory)
181 (packages-find-package-data-path last-packages)))
183 ;;; setup-paths.el ends here