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-load-path-depth 1
42 "Depth of load-path searches in core Lisp paths.")
44 (defvar paths-default-info-directories
45 (list (paths-construct-path '("usr" "local" "info")
46 (char-to-string directory-sep-char))
47 (paths-construct-path '("usr" "info")
48 (char-to-string directory-sep-char)))
49 "Directories appended to the end of the info path by default.")
51 (defun paths-find-site-lisp-directory (roots)
52 "Find the site Lisp directory of the XEmacs hierarchy."
53 (paths-find-site-directory roots "site-lisp"
55 configure-site-directory))
57 (defun paths-find-site-module-directory (roots)
58 "Find the site modules directory of the XEmacs hierarchy."
59 (paths-find-site-directory roots "site-modules"
61 configure-site-module-directory))
63 (defun paths-find-lisp-directory (roots)
64 "Find the main Lisp directory of the XEmacs hierarchy."
65 (paths-find-version-directory roots "lisp"
67 configure-lisp-directory))
69 (defun paths-find-module-directory (roots)
70 "Find the main modules directory of the XEmacs hierarchy."
71 (paths-find-architecture-directory roots "modules"
72 configure-module-directory))
74 (defun paths-construct-load-path
75 (roots early-package-load-path late-package-load-path last-package-load-path
77 &optional site-lisp-directory)
78 "Construct the load path."
79 (let* ((envvar-value (getenv "EMACSLOADPATH"))
82 (paths-decode-directory-path envvar-value 'drop-empties)))
84 (and site-lisp-directory
85 (paths-find-recursive-load-path (list site-lisp-directory)
86 paths-load-path-depth)))
89 (paths-find-recursive-load-path (list lisp-directory)
90 paths-load-path-depth))))
92 early-package-load-path
94 late-package-load-path
96 last-package-load-path)))
98 (defun paths-construct-module-load-path
99 (root module-directory &optional site-module-directory)
100 "Construct the modules load path."
101 (let* ((envvar-value (getenv "EMACSMODULEPATH"))
104 (paths-decode-directory-path envvar-value 'drop-empties)))
105 (site-module-load-path
106 (and site-module-directory
107 (paths-find-recursive-load-path (list site-module-directory)
108 paths-load-path-depth)))
110 (and module-directory
111 (paths-find-recursive-load-path (list module-directory)
112 paths-load-path-depth))))
113 (append env-module-path
114 site-module-load-path
117 (defun paths-construct-info-path (roots early-packages late-packages last-packages)
118 "Construct the info path."
119 (let ((info-path-envval (getenv "INFOPATH")))
122 (let ((info-directory
123 (paths-find-version-directory roots "info"
125 configure-info-directory)))
127 (list info-directory)))
128 (packages-find-package-info-path early-packages)
129 (packages-find-package-info-path late-packages)
130 (packages-find-package-info-path last-packages)
131 (and info-path-envval
132 (paths-decode-directory-path info-path-envval 'drop-empties)))
133 (and (null info-path-envval)
135 (paths-directories-which-exist configure-info-path)
136 (paths-directories-which-exist paths-default-info-directories))))))
138 (defun paths-find-doc-directory (roots)
139 "Find the documentation directory."
140 (paths-find-architecture-directory roots "lib-src"))
142 (defun paths-find-lock-directory (roots)
143 "Find the lock directory."
144 (defvar configure-lock-directory)
145 (paths-find-site-directory roots "lock" "EMACSLOCKDIR" configure-lock-directory))
147 (defun paths-find-superlock-file (lock-directory)
148 "Find the superlock file."
149 ;; #### There is no such variable configure-superlock-file!
151 ((null lock-directory)
153 ((and configure-superlock-file
154 (file-directory-p (file-name-directory configure-superlock-file)))
155 configure-superlock-file)
157 (expand-file-name "!!!SuperLock!!!" lock-directory))))
159 (defun paths-find-exec-directory (roots)
160 "Find the binary directory."
161 (paths-find-architecture-directory roots "lib-src" configure-exec-directory))
163 (defun paths-construct-exec-path (roots exec-directory
164 early-packages late-packages last-packages)
165 "Find the binary path."
167 (let ((path-envval (getenv "PATH")))
169 (paths-decode-directory-path path-envval 'drop-empties)))
170 (packages-find-package-exec-path early-packages)
171 (packages-find-package-exec-path late-packages)
172 (let ((emacspath-envval (getenv "EMACSPATH")))
173 (and emacspath-envval
174 (split-path emacspath-envval)))
176 (list exec-directory))
177 (packages-find-package-exec-path last-packages)))
179 (defun paths-find-data-directory (roots)
180 "Find the data directory."
181 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory))
183 (defun paths-construct-data-directory-list (data-directory
184 early-packages late-packages last-packages)
185 "Find the data path."
187 (packages-find-package-data-path early-packages)
188 (packages-find-package-data-path late-packages)
189 (list data-directory)
190 (packages-find-package-data-path last-packages)))
192 ;;; setup-paths.el ends here