Remove configure's --with-mmdf option
[emacs.git] / lisp / version.el
blob1837cbf0a85c3cbcdf1d0edfa89fcadb5fe21ee3
1 ;;; version.el --- record version number of Emacs
3 ;; Copyright (C) 1985, 1992, 1994-1995, 1999-2015 Free Software
4 ;; Foundation, Inc.
6 ;; Maintainer: emacs-devel@gnu.org
7 ;; Keywords: internal
8 ;; Package: emacs
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Commentary:
27 ;;; Code:
29 (defconst emacs-major-version
30 (progn (string-match "^[0-9]+" emacs-version)
31 (string-to-number (match-string 0 emacs-version)))
32 "Major version number of this version of Emacs.
33 This variable first existed in version 19.23.")
35 (defconst emacs-minor-version
36 (progn (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
37 (string-to-number (match-string 1 emacs-version)))
38 "Minor version number of this version of Emacs.
39 This variable first existed in version 19.23.")
41 (defconst emacs-build-time (current-time)
42 "Time at which Emacs was dumped out.")
44 (defconst emacs-build-system (system-name)
45 "Name of the system on which Emacs was built.")
47 (defvar motif-version-string)
48 (defvar gtk-version-string)
49 (defvar ns-version-string)
51 (defun emacs-version (&optional here)
52 "Return string describing the version of Emacs that is running.
53 If optional argument HERE is non-nil, insert string at point.
54 Don't use this function in programs to choose actions according
55 to the system configuration; look at `system-configuration' instead."
56 (interactive "P")
57 (let ((version-string
58 (format (if (not (called-interactively-p 'interactive))
59 "GNU Emacs %s (%s%s%s)\n of %s on %s"
60 "GNU Emacs %s (%s%s%s) of %s on %s")
61 emacs-version
62 system-configuration
63 (cond ((featurep 'motif)
64 (concat ", " (substring motif-version-string 4)))
65 ((featurep 'gtk)
66 (concat ", GTK+ Version " gtk-version-string))
67 ((featurep 'x-toolkit) ", X toolkit")
68 ((featurep 'ns)
69 (format ", NS %s" ns-version-string))
70 (t ""))
71 (if (and (boundp 'x-toolkit-scroll-bars)
72 (memq x-toolkit-scroll-bars '(xaw xaw3d)))
73 (format ", %s scroll bars"
74 (capitalize (symbol-name x-toolkit-scroll-bars)))
75 "")
76 (format-time-string "%Y-%m-%d" emacs-build-time)
77 emacs-build-system)))
78 (if here
79 (insert version-string)
80 (if (called-interactively-p 'interactive)
81 (message "%s" version-string)
82 version-string))))
84 ;; We hope that this alias is easier for people to find.
85 (defalias 'version 'emacs-version)
87 ;; Set during dumping, this is a defvar so that it can be setq'd.
88 (defvar emacs-repository-version nil
89 "String giving the repository revision from which this Emacs was built.
90 Value is nil if Emacs was not built from a repository checkout,
91 or if we could not determine the revision.")
93 (define-obsolete-variable-alias 'emacs-bzr-version
94 'emacs-repository-version "24.4")
96 (define-obsolete-function-alias 'emacs-bzr-get-version
97 'emacs-repository-get-version "24.4")
99 (defun emacs-repository-get-version (&optional dir external)
100 "Try to return as a string the repository revision of the Emacs sources.
101 The format of the returned string is dependent on the VCS in use.
102 Value is nil if the sources do not seem to be under version
103 control, or if we could not determine the revision. Note that
104 this reports on the current state of the sources, which may not
105 correspond to the running Emacs.
107 Optional argument DIR is a directory to use instead of
108 `source-directory'. Optional argument EXTERNAL is ignored and is
109 retained for compatibility."
110 (or dir (setq dir source-directory))
111 (cond ((file-directory-p (expand-file-name ".git" dir))
112 (message "Waiting for git...")
113 (with-temp-buffer
114 (let ((default-directory (file-name-as-directory dir)))
115 (and (eq 0
116 (condition-case nil
117 (call-process "git" nil '(t nil) nil "rev-parse"
118 "HEAD")
119 (error nil)))
120 (not (zerop (buffer-size)))
121 (replace-regexp-in-string "\n" "" (buffer-string))))))))
123 ;; We put version info into the executable in the form that `ident' uses.
124 (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version))
125 " $\n"))
127 ;;; version.el ends here