diff options
| author | Ken Raeburn | 2010-05-15 17:11:37 -0400 |
|---|---|---|
| committer | Ken Raeburn | 2010-05-15 17:11:37 -0400 |
| commit | 8c5ff6dd241db176fb178b4d84dbab93ad2475c9 (patch) | |
| tree | 4c52177fac2371274af2370992edfb8353936e3c /src | |
| parent | 2e9abc3d5340f07c181d3cbeba5d92d36dea5a34 (diff) | |
| download | emacs-8c5ff6dd241db176fb178b4d84dbab93ad2475c9.tar.gz emacs-8c5ff6dd241db176fb178b4d84dbab93ad2475c9.zip | |
Handle --version reasonably in CANNOT_DUMP configuration.
* src/emacs.c (emacs_version, emacs_copyright): New string
variables.
(Vemacs_version, Vemacs_copyright): New Lisp_Object variables.
(syms_of_emacs): Defvar them, and initialize them from the C
string variables.
(main): If initialization hasn't been done, print initial version
info from the C strings, instead of starting an interactive session.
* lisp/version.el (emacs-copyright, emacs-version): Don't define
here.
* configure.in: Look for version string in its new place.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/config.in | 65 | ||||
| -rw-r--r-- | src/emacs.c | 69 |
3 files changed, 90 insertions, 54 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 30bd78e208c..31084286ddb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2010-05-15 Ken Raeburn <raeburn@raeburn.org> | ||
| 2 | |||
| 3 | Handle --version reasonably in CANNOT_DUMP configuration. | ||
| 4 | * emacs.c (emacs_version, emacs_copyright): New string variables. | ||
| 5 | (Vemacs_version, Vemacs_copyright): New Lisp_Object variables. | ||
| 6 | (syms_of_emacs): Defvar them, and initialize them from the C | ||
| 7 | string variables. | ||
| 8 | (main): If initialization hasn't been done, print initial version | ||
| 9 | info from the C strings, instead of starting an interactive session. | ||
| 10 | |||
| 1 | 2010-05-15 Eli Zaretskii <eliz@gnu.org> | 11 | 2010-05-15 Eli Zaretskii <eliz@gnu.org> |
| 2 | 12 | ||
| 3 | * bidi.c (bidi_paragraph_init): Don't leave alone garbage values | 13 | * bidi.c (bidi_paragraph_init): Don't leave alone garbage values |
diff --git a/src/config.in b/src/config.in index 35530943682..4a0f58cc7da 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -315,10 +315,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 315 | /* Define to 1 if you have the <kerberos/krb.h> header file. */ | 315 | /* Define to 1 if you have the <kerberos/krb.h> header file. */ |
| 316 | #undef HAVE_KERBEROS_KRB_H | 316 | #undef HAVE_KERBEROS_KRB_H |
| 317 | 317 | ||
| 318 | /* Define to 1 if `e_text' is member of `krb5_error'. */ | 318 | /* Define to 1 if `e_text' is a member of `krb5_error'. */ |
| 319 | #undef HAVE_KRB5_ERROR_E_TEXT | 319 | #undef HAVE_KRB5_ERROR_E_TEXT |
| 320 | 320 | ||
| 321 | /* Define to 1 if `text' is member of `krb5_error'. */ | 321 | /* Define to 1 if `text' is a member of `krb5_error'. */ |
| 322 | #undef HAVE_KRB5_ERROR_TEXT | 322 | #undef HAVE_KRB5_ERROR_TEXT |
| 323 | 323 | ||
| 324 | /* Define to 1 if you have the <krb5.h> header file. */ | 324 | /* Define to 1 if you have the <krb5.h> header file. */ |
| @@ -609,25 +609,25 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 609 | /* Define to 1 if you have the `strsignal' function. */ | 609 | /* Define to 1 if you have the `strsignal' function. */ |
| 610 | #undef HAVE_STRSIGNAL | 610 | #undef HAVE_STRSIGNAL |
| 611 | 611 | ||
| 612 | /* Define to 1 if `ifr_addr' is member of `struct ifreq'. */ | 612 | /* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */ |
| 613 | #undef HAVE_STRUCT_IFREQ_IFR_ADDR | 613 | #undef HAVE_STRUCT_IFREQ_IFR_ADDR |
| 614 | 614 | ||
| 615 | /* Define to 1 if `ifr_broadaddr' is member of `struct ifreq'. */ | 615 | /* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */ |
| 616 | #undef HAVE_STRUCT_IFREQ_IFR_BROADADDR | 616 | #undef HAVE_STRUCT_IFREQ_IFR_BROADADDR |
| 617 | 617 | ||
| 618 | /* Define to 1 if `ifr_flags' is member of `struct ifreq'. */ | 618 | /* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */ |
| 619 | #undef HAVE_STRUCT_IFREQ_IFR_FLAGS | 619 | #undef HAVE_STRUCT_IFREQ_IFR_FLAGS |
| 620 | 620 | ||
| 621 | /* Define to 1 if `ifr_hwaddr' is member of `struct ifreq'. */ | 621 | /* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ |
| 622 | #undef HAVE_STRUCT_IFREQ_IFR_HWADDR | 622 | #undef HAVE_STRUCT_IFREQ_IFR_HWADDR |
| 623 | 623 | ||
| 624 | /* Define to 1 if `ifr_netmask' is member of `struct ifreq'. */ | 624 | /* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */ |
| 625 | #undef HAVE_STRUCT_IFREQ_IFR_NETMASK | 625 | #undef HAVE_STRUCT_IFREQ_IFR_NETMASK |
| 626 | 626 | ||
| 627 | /* Define to 1 if `n_un.n_name' is member of `struct nlist'. */ | 627 | /* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ |
| 628 | #undef HAVE_STRUCT_NLIST_N_UN_N_NAME | 628 | #undef HAVE_STRUCT_NLIST_N_UN_N_NAME |
| 629 | 629 | ||
| 630 | /* Define to 1 if `tm_zone' is member of `struct tm'. */ | 630 | /* Define to 1 if `tm_zone' is a member of `struct tm'. */ |
| 631 | #undef HAVE_STRUCT_TM_TM_ZONE | 631 | #undef HAVE_STRUCT_TM_TM_ZONE |
| 632 | 632 | ||
| 633 | /* Define to 1 if `struct utimbuf' is declared by <utime.h>. */ | 633 | /* Define to 1 if `struct utimbuf' is declared by <utime.h>. */ |
| @@ -853,6 +853,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 853 | /* Define to the one symbol short name of this package. */ | 853 | /* Define to the one symbol short name of this package. */ |
| 854 | #undef PACKAGE_TARNAME | 854 | #undef PACKAGE_TARNAME |
| 855 | 855 | ||
| 856 | /* Define to the home page for this package. */ | ||
| 857 | #undef PACKAGE_URL | ||
| 858 | |||
| 856 | /* Define to the version of this package. */ | 859 | /* Define to the version of this package. */ |
| 857 | #undef PACKAGE_VERSION | 860 | #undef PACKAGE_VERSION |
| 858 | 861 | ||
| @@ -912,6 +915,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 912 | /* Define to 1 if using the Motif X toolkit. */ | 915 | /* Define to 1 if using the Motif X toolkit. */ |
| 913 | #undef USE_MOTIF | 916 | #undef USE_MOTIF |
| 914 | 917 | ||
| 918 | /* Enable extensions on AIX 3, Interix. */ | ||
| 919 | #ifndef _ALL_SOURCE | ||
| 920 | # undef _ALL_SOURCE | ||
| 921 | #endif | ||
| 922 | /* Enable GNU extensions on systems that have them. */ | ||
| 923 | #ifndef _GNU_SOURCE | ||
| 924 | # undef _GNU_SOURCE | ||
| 925 | #endif | ||
| 926 | /* Enable threading extensions on Solaris. */ | ||
| 927 | #ifndef _POSIX_PTHREAD_SEMANTICS | ||
| 928 | # undef _POSIX_PTHREAD_SEMANTICS | ||
| 929 | #endif | ||
| 930 | /* Enable extensions on HP NonStop. */ | ||
| 931 | #ifndef _TANDEM_SOURCE | ||
| 932 | # undef _TANDEM_SOURCE | ||
| 933 | #endif | ||
| 934 | /* Enable general extensions on Solaris. */ | ||
| 935 | #ifndef __EXTENSIONS__ | ||
| 936 | # undef __EXTENSIONS__ | ||
| 937 | #endif | ||
| 938 | |||
| 939 | |||
| 915 | /* Define to 1 if we should use toolkit scroll bars. */ | 940 | /* Define to 1 if we should use toolkit scroll bars. */ |
| 916 | #undef USE_TOOLKIT_SCROLL_BARS | 941 | #undef USE_TOOLKIT_SCROLL_BARS |
| 917 | 942 | ||
| @@ -947,28 +972,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 947 | /* Define to 1 if you need to in order for `stat' and other things to work. */ | 972 | /* Define to 1 if you need to in order for `stat' and other things to work. */ |
| 948 | #undef _POSIX_SOURCE | 973 | #undef _POSIX_SOURCE |
| 949 | 974 | ||
| 950 | /* Enable extensions on AIX 3, Interix. */ | ||
| 951 | #ifndef _ALL_SOURCE | ||
| 952 | # undef _ALL_SOURCE | ||
| 953 | #endif | ||
| 954 | /* Enable GNU extensions on systems that have them. */ | ||
| 955 | #ifndef _GNU_SOURCE | ||
| 956 | # undef _GNU_SOURCE | ||
| 957 | #endif | ||
| 958 | /* Enable threading extensions on Solaris. */ | ||
| 959 | #ifndef _POSIX_PTHREAD_SEMANTICS | ||
| 960 | # undef _POSIX_PTHREAD_SEMANTICS | ||
| 961 | #endif | ||
| 962 | /* Enable extensions on HP NonStop. */ | ||
| 963 | #ifndef _TANDEM_SOURCE | ||
| 964 | # undef _TANDEM_SOURCE | ||
| 965 | #endif | ||
| 966 | /* Enable general extensions on Solaris. */ | ||
| 967 | #ifndef __EXTENSIONS__ | ||
| 968 | # undef __EXTENSIONS__ | ||
| 969 | #endif | ||
| 970 | |||
| 971 | |||
| 972 | /* Define to rpl_ if the getopt replacement functions and variables should be | 975 | /* Define to rpl_ if the getopt replacement functions and variables should be |
| 973 | used. */ | 976 | used. */ |
| 974 | #undef __GETOPT_PREFIX | 977 | #undef __GETOPT_PREFIX |
diff --git a/src/emacs.c b/src/emacs.c index 6b19b45d0b0..36db274adf6 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -87,6 +87,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 87 | #endif | 87 | #endif |
| 88 | #endif | 88 | #endif |
| 89 | 89 | ||
| 90 | const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; | ||
| 91 | const char emacs_version[] = "24.0.50"; | ||
| 92 | |||
| 90 | extern void malloc_warning P_ ((char *)); | 93 | extern void malloc_warning P_ ((char *)); |
| 91 | extern void set_time_zone_rule P_ ((char *)); | 94 | extern void set_time_zone_rule P_ ((char *)); |
| 92 | #ifdef HAVE_INDEX | 95 | #ifdef HAVE_INDEX |
| @@ -180,6 +183,10 @@ Lisp_Object Vprevious_system_messages_locale; | |||
| 180 | Lisp_Object Vsystem_time_locale; | 183 | Lisp_Object Vsystem_time_locale; |
| 181 | Lisp_Object Vprevious_system_time_locale; | 184 | Lisp_Object Vprevious_system_time_locale; |
| 182 | 185 | ||
| 186 | /* Copyright and version info. The version number may be updated by | ||
| 187 | Lisp code. */ | ||
| 188 | Lisp_Object Vemacs_copyright, Vemacs_version; | ||
| 189 | |||
| 183 | /* If non-zero, emacs should not attempt to use a window-specific code, | 190 | /* If non-zero, emacs should not attempt to use a window-specific code, |
| 184 | but instead should use the virtual terminal under which it was started. */ | 191 | but instead should use the virtual terminal under which it was started. */ |
| 185 | int inhibit_window_system; | 192 | int inhibit_window_system; |
| @@ -802,35 +809,43 @@ main (int argc, char **argv) | |||
| 802 | argc = 0; | 809 | argc = 0; |
| 803 | while (argv[argc]) argc++; | 810 | while (argv[argc]) argc++; |
| 804 | 811 | ||
| 805 | if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args) | 812 | if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args)) |
| 806 | /* We don't know the version number unless this is a dumped Emacs. | ||
| 807 | So ignore --version otherwise. */ | ||
| 808 | && initialized) | ||
| 809 | { | 813 | { |
| 810 | Lisp_Object tem, tem2; | 814 | const char *version, *copyright; |
| 811 | tem = Fsymbol_value (intern_c_string ("emacs-version")); | 815 | if (initialized) |
| 812 | tem2 = Fsymbol_value (intern_c_string ("emacs-copyright")); | ||
| 813 | if (!STRINGP (tem)) | ||
| 814 | { | ||
| 815 | fprintf (stderr, "Invalid value of `emacs-version'\n"); | ||
| 816 | exit (1); | ||
| 817 | } | ||
| 818 | if (!STRINGP (tem2)) | ||
| 819 | { | 816 | { |
| 820 | fprintf (stderr, "Invalid value of `emacs-copyright'\n"); | 817 | Lisp_Object tem, tem2; |
| 821 | exit (1); | 818 | tem = Fsymbol_value (intern_c_string ("emacs-version")); |
| 819 | tem2 = Fsymbol_value (intern_c_string ("emacs-copyright")); | ||
| 820 | if (!STRINGP (tem)) | ||
| 821 | { | ||
| 822 | fprintf (stderr, "Invalid value of `emacs-version'\n"); | ||
| 823 | exit (1); | ||
| 824 | } | ||
| 825 | if (!STRINGP (tem2)) | ||
| 826 | { | ||
| 827 | fprintf (stderr, "Invalid value of `emacs-copyright'\n"); | ||
| 828 | exit (1); | ||
| 829 | } | ||
| 830 | else | ||
| 831 | { | ||
| 832 | version = SDATA (tem); | ||
| 833 | copyright = SDATA (tem2); | ||
| 834 | } | ||
| 822 | } | 835 | } |
| 823 | else | 836 | else |
| 824 | { | 837 | { |
| 825 | printf ("GNU Emacs %s\n", SDATA (tem)); | 838 | version = emacs_version; |
| 826 | printf ("%s\n", SDATA(tem2)); | 839 | copyright = emacs_copyright; |
| 827 | printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n"); | ||
| 828 | printf ("You may redistribute copies of Emacs\n"); | ||
| 829 | printf ("under the terms of the GNU General Public License.\n"); | ||
| 830 | printf ("For more information about these matters, "); | ||
| 831 | printf ("see the file named COPYING.\n"); | ||
| 832 | exit (0); | ||
| 833 | } | 840 | } |
| 841 | printf ("GNU Emacs %s\n", version); | ||
| 842 | printf ("%s\n", copyright); | ||
| 843 | printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n"); | ||
| 844 | printf ("You may redistribute copies of Emacs\n"); | ||
| 845 | printf ("under the terms of the GNU General Public License.\n"); | ||
| 846 | printf ("For more information about these matters, "); | ||
| 847 | printf ("see the file named COPYING.\n"); | ||
| 848 | exit (0); | ||
| 834 | } | 849 | } |
| 835 | if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) | 850 | if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) |
| 836 | if (chdir (ch_to_dir) == -1) | 851 | if (chdir (ch_to_dir) == -1) |
| @@ -2577,6 +2592,14 @@ This is nil during initialization. */); | |||
| 2577 | doc: /* If non-nil, X resources, Windows Registry settings, and NS defaults are not used. */); | 2592 | doc: /* If non-nil, X resources, Windows Registry settings, and NS defaults are not used. */); |
| 2578 | inhibit_x_resources = 0; | 2593 | inhibit_x_resources = 0; |
| 2579 | 2594 | ||
| 2595 | DEFVAR_LISP ("emacs-copyright", &Vemacs_copyright, | ||
| 2596 | doc: /* Short copyright string for this version of Emacs. */); | ||
| 2597 | Vemacs_copyright = build_string (emacs_copyright); | ||
| 2598 | |||
| 2599 | DEFVAR_LISP ("emacs-version", &Vemacs_version, | ||
| 2600 | doc: /* Version numbers of this version of Emacs. */); | ||
| 2601 | Vemacs_version = build_string (emacs_version); | ||
| 2602 | |||
| 2580 | /* Make sure IS_DAEMON starts up as false. */ | 2603 | /* Make sure IS_DAEMON starts up as false. */ |
| 2581 | daemon_pipe[1] = 0; | 2604 | daemon_pipe[1] = 0; |
| 2582 | } | 2605 | } |