| 1 |
;;;; -*- Mode: Lisp; Syntax: Common-Lisp; indent-tabs-mode: nil -*- |
| 2 |
;;;; vim: set filetype=lisp tabstop=8 shiftwidth=2 expandtab: |
| 3 |
|
| 4 |
;; @configure_input@ |
| 5 |
;; |
| 6 |
;; Configuration file for ECL |
| 7 |
;; |
| 8 |
(in-package "COMMON-LISP") |
| 9 |
|
| 10 |
#+(and (not ecl-min) (not nacl) (not windows) (not mingw32) uname) |
| 11 |
(ffi:clines " |
| 12 |
#include <sys/utsname.h> |
| 13 |
") |
| 14 |
|
| 15 |
#+(and (not ecl-min) (not nacl) (not windows) (not mingw32) uname) |
| 16 |
(defun uname () |
| 17 |
(ffi:c-inline () () :object "{ |
| 18 |
cl_object output; |
| 19 |
struct utsname aux; |
| 20 |
if (uname(&aux) < 0) |
| 21 |
output = ECL_NIL; |
| 22 |
else |
| 23 |
output = cl_list(5, ecl_make_simple_base_string(aux.sysname,-1), |
| 24 |
ecl_make_simple_base_string(aux.nodename,-1), |
| 25 |
ecl_make_simple_base_string(aux.release,-1), |
| 26 |
ecl_make_simple_base_string(aux.version,-1), |
| 27 |
ecl_make_simple_base_string(aux.machine,-1)); |
| 28 |
@(return) = output; |
| 29 |
}" :one-liner nil)) |
| 30 |
|
| 31 |
#+(and ecl-min uname) |
| 32 |
(defun uname () |
| 33 |
"A poor man's uname" |
| 34 |
(list "@SOFTWARE_TYPE@" |
| 35 |
NIL #| hostname |# |
| 36 |
#.(let ((aux "@SOFTWARE_VERSION@")) |
| 37 |
(when (plusp (length aux)) |
| 38 |
aux)) |
| 39 |
NIL #| kernel version |# |
| 40 |
"@ARCHITECTURE@")) |
| 41 |
|
| 42 |
;; |
| 43 |
;; * Short and long site names |
| 44 |
;; |
| 45 |
;; Edit these with the name of your site: |
| 46 |
;; |
| 47 |
(defun short-site-name () |
| 48 |
"Args: () |
| 49 |
Returns, as a string, the location of the machine on which ECL runs." |
| 50 |
nil) |
| 51 |
|
| 52 |
(defun long-site-name () |
| 53 |
"Args: () |
| 54 |
Returns, as a string, the location of the machine on which ECL runs." |
| 55 |
nil) |
| 56 |
|
| 57 |
;; |
| 58 |
;; * ECL version, architecture, etc |
| 59 |
;; |
| 60 |
(defun lisp-implementation-version () |
| 61 |
"Args:() |
| 62 |
Returns the version of your ECL as a string." |
| 63 |
"@PACKAGE_VERSION@") |
| 64 |
|
| 65 |
(defun ext:lisp-implementation-vcs-id () |
| 66 |
#.si::+commit-id+) |
| 67 |
|
| 68 |
(defun machine-type () |
| 69 |
"Args: () |
| 70 |
Returns, as a string, the type of the machine on which ECL runs." |
| 71 |
(or (ext:getenv "HOSTTYPE") |
| 72 |
#+(or :mingw32 :msvc :cygwin) |
| 73 |
(ext:getenv "PROCESSOR_ARCHITECTURE") |
| 74 |
#+uname |
| 75 |
(fifth (uname)) |
| 76 |
"@ARCHITECTURE@")) |
| 77 |
|
| 78 |
(defun machine-instance () |
| 79 |
"Args: () |
| 80 |
Returns, as a string, the identifier of the machine on which ECL runs." |
| 81 |
(or (ext:getenv "HOSTNAME") |
| 82 |
#+(or :mingw32 :msvc :cygwin) |
| 83 |
(ext:getenv "COMPUTERNAME") |
| 84 |
#+uname |
| 85 |
(second (uname)) |
| 86 |
)) |
| 87 |
|
| 88 |
(defun machine-version () |
| 89 |
"Args: () |
| 90 |
Returns, as a string, the version of the machine on which ECL runs. Obtained from |
| 91 |
uname(2) where available." |
| 92 |
(or #+(or :mingw32 :msvc :cygwin) |
| 93 |
(ext:getenv "PROCESSOR_LEVEL"))) |
| 94 |
|
| 95 |
(pushnew :@thehost@ *features*) |
| 96 |
|
| 97 |
(defun software-type () |
| 98 |
"Args: () |
| 99 |
Returns, as a string, the type of the software under which ECL runs." |
| 100 |
(or #+uname (first (uname)) |
| 101 |
"@SOFTWARE_TYPE@")) |
| 102 |
|
| 103 |
(defun software-version () |
| 104 |
"Args: () |
| 105 |
Returns, as a string, the version of the software under which ECL runs." |
| 106 |
(or #+uname (third (uname)) |
| 107 |
#.(let ((aux "@SOFTWARE_VERSION@")) |
| 108 |
(if (plusp (length aux)) |
| 109 |
aux |
| 110 |
nil)))) |
| 111 |
|
| 112 |
;; |
| 113 |
;; * Set up some room |
| 114 |
;; |
| 115 |
#-boehm-gc |
| 116 |
(progn |
| 117 |
(sys::allocate 'CONS 200) |
| 118 |
(sys::allocate 'BASE-STRING 40)) |
| 119 |
|
| 120 |
;; |
| 121 |
;; * Set configuration pathnames. Notice the trailing slash! |
| 122 |
;; Otherwise it would not be a directory. |
| 123 |
;; |
| 124 |
#-msvc |
| 125 |
(si::pathname-translations "HOME" '(("**;*.*" "~/**/*.*"))) |
| 126 |
#+msvc |
| 127 |
(si::pathname-translations "HOME" |
| 128 |
`(("**;*.*" ,(merge-pathnames "**/*.*" (user-homedir-pathname))))) |
| 129 |
(let (x) |
| 130 |
(cond ((and (setf x (ext:getenv "TMPDIR")) |
| 131 |
(probe-file x))) |
| 132 |
((and (setf x (ext:getenv "TEMP")) |
| 133 |
(probe-file x))) |
| 134 |
((and (setf x (ext:getenv "TMP")) |
| 135 |
(probe-file x))) |
| 136 |
(t (setf x #+unix "/tmp" #-unix "./"))) |
| 137 |
(si::pathname-translations "TMP" |
| 138 |
`(("**;*.*" ,(format nil "~A/**/*.*" x))))) |
| 139 |
|
| 140 |
#-ecl-min |
| 141 |
(macrolet ((define-pathname-translations (name base-pathname) |
| 142 |
`(let ((path ,base-pathname)) |
| 143 |
(when path |
| 144 |
(si::pathname-translations |
| 145 |
,name `(("**;*.*" ,(merge-pathnames "**/*.*" path)))))))) |
| 146 |
(define-pathname-translations "SYS" (si::get-library-pathname)) |
| 147 |
(let ((x (ext:getenv "ECLSRCDIR"))) |
| 148 |
;; Notice we use true_srcdir, which in Windows resolves to a |
| 149 |
;; Windows pathname, not a mingw/cygwin pathname |
| 150 |
(unless (and x (setq x (probe-file x))) |
| 151 |
(setf x #.(truename "@true_srcdir@/"))) |
| 152 |
(define-pathname-translations "SRC" x) |
| 153 |
(define-pathname-translations "EXT" (merge-pathnames "../contrib/" x)) |
| 154 |
)) |