Add 2012 to FSF copyright years for Emacs files
[bpt/emacs.git] / src / s / gnu-linux.h
CommitLineData
3a707ba5 1/* This file is the configuration file for Linux-based GNU systems
2f86b22b 2
acaf905b 3Copyright (C) 1985-1986, 1992, 1994, 1996, 1999, 2001-2012
e9bffc61 4 Free Software Foundation, Inc.
566e3587 5
e05aebe9
GM
6This file was put together by Michael K. Johnson and Rik Faith.
7
566e3587
JB
8This file is part of GNU Emacs.
9
4b158629 10GNU Emacs is free software: you can redistribute it and/or modify
566e3587 11it under the terms of the GNU General Public License as published by
4b158629
GM
12the Free Software Foundation, either version 3 of the License, or
13(at your option) any later version.
566e3587
JB
14
15GNU Emacs is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
4b158629 21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
566e3587 22
e05aebe9
GM
23/* Define symbols to identify the version of Unix this is.
24 Define all the symbols that apply correctly. */
566e3587 25#define USG
8db5530a 26#define GNU_LINUX
566e3587
JB
27
28/* SYSTEM_TYPE should indicate the kind of system you are using.
e05aebe9 29 It sets the Lisp variable system-type. */
3a707ba5 30#define SYSTEM_TYPE "gnu/linux" /* All the best software is free. */
566e3587 31
65953053 32#ifdef emacs
b764619d 33#ifdef HAVE_LINUX_VERSION_H
65953053 34#include <linux/version.h>
566e3587 35
85a71b37 36#if LINUX_VERSION_CODE >= 0x20400
c5e7567d
DN
37/* 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works. */
38#define SIGNALS_VIA_CHARACTERS
85a71b37 39#endif /* LINUX_VERSION_CODE >= 0x20400 */
b764619d 40#endif /* HAVE_LINUX_VERSION_H */
aa7fcbb0 41#endif /* emacs */
566e3587 42
71125fb8
GM
43#if defined HAVE_GRANTPT
44#define UNIX98_PTYS
566e3587 45
e05aebe9 46/* Run only once. We need a `for'-loop because the code uses `continue'. */
be02381c 47#define PTY_ITERATION int i; for (i = 0; i < 1; i++)
fdc5e0fc 48
71125fb8
GM
49#ifdef HAVE_GETPT
50#define PTY_NAME_SPRINTF
51#define PTY_OPEN fd = getpt ()
52#else /* not HAVE_GETPT */
53#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
54#endif /* not HAVE_GETPT */
55
56/* Note that grantpt and unlockpt may fork. We must block SIGCHLD to
57 prevent sigchld_handler from intercepting the child's death. */
71125fb8
GM
58#define PTY_TTY_NAME_SPRINTF \
59 { \
60 char *ptyname; \
61 \
62 sigblock (sigmask (SIGCHLD)); \
63 if (grantpt (fd) == -1 || unlockpt (fd) == -1 \
64 || !(ptyname = ptsname(fd))) \
65 { \
66 sigunblock (sigmask (SIGCHLD)); \
67 close (fd); \
68 return -1; \
69 } \
70 strncpy (pty_name, ptyname, sizeof (pty_name)); \
71 pty_name[sizeof (pty_name) - 1] = 0; \
72 sigunblock (sigmask (SIGCHLD)); \
73 }
fdc5e0fc 74
dacbb818 75#else /* not HAVE_GRANTPT */
fdc5e0fc 76
71125fb8
GM
77/* Letter to use in finding device name of first pty,
78 if system supports pty's. 'p' means it is /dev/ptyp0 */
71125fb8 79#define FIRST_PTY_LETTER 'p'
fdc5e0fc 80
132d0475 81#endif /* not HAVE_GRANTPT */
fdc5e0fc 82
e05aebe9 83/* Define HAVE_PTYS if the system supports pty devices. */
566e3587
JB
84#define HAVE_PTYS
85
dad29761 86#define HAVE_SOCKETS
566e3587 87
06e111a6 88/* This is used in list_system_processes. */
40c5931c 89#define HAVE_PROCFS 1
40c5931c 90
566e3587
JB
91/* Define CLASH_DETECTION if you want lock files to be written
92 so that Emacs can tell instantly when you try to modify
93 a file that someone else has modified in his Emacs. */
b2e209ba 94#define CLASH_DETECTION
566e3587
JB
95
96/* Here, on a separate page, add any special hacks needed
97 to make Emacs work on this system. For example,
98 you might define certain system call names that don't
99 exist on your system, or that do different things on
100 your system and must be used only through an encapsulation
101 (Which you should place, by convention, in sysdep.c). */
102\f
e05aebe9 103/* This is needed for dispnew.c:update_frame. */
5e5623c2 104#ifdef emacs
a9c82aaf 105#include <stdio.h> /* Get the definition of _IO_STDIO_H. */
5e617bc2 106#if defined (_IO_STDIO_H) || defined (_STDIO_USES_IOSTREAM)
e05aebe9 107/* New C libio names. */
c2c3f859 108#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
5e5623c2 109 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
65f451d0 110#elif defined (__UCLIBC__)
e05aebe9 111/* Using the uClibc library. */
65f451d0
DN
112#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
113 ((FILE)->__bufpos - (FILE)->__bufstart)
114#else /* !_IO_STDIO_H && ! __UCLIBC__ */
e05aebe9 115/* Old C++ iostream names. */
c2c3f859 116#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
5e5623c2 117 ((FILE)->_pptr - (FILE)->_pbase)
65f451d0 118#endif /* !_IO_STDIO_H && ! __UCLIBC__ */
566e3587 119
65953053 120#define INTERRUPT_INPUT
9539dc5d 121#endif /* emacs */
566e3587 122
1abbab7a 123#define POSIX /* affects getpagesize.h and systty.h */
566e3587 124
639f52d8
RS
125/* This is to work around mysterious gcc failures in some system versions.
126 It is unlikely that Emacs changes will work around this problem;
127 therefore, this should remain permanently. */
e3b89505
RS
128#ifndef HAVE_XRMSETDATABASE
129#define HAVE_XRMSETDATABASE
130#endif
e2000885 131
2327e4a0
GM
132#define NARROWPROTO 1
133
bb15bd9a 134/* Tell that garbage collector that setjmp is known to save all
e05aebe9 135 registers relevant for conservative garbage collection in the jmp_buf. */
e7b6b572
DL
136/* Not all the architectures are tested, but there are Debian packages
137 for SCM and/or Guile on them, so the technique must work. See also
138 comments in alloc.c concerning setjmp and gcc. Fixme: it's
139 probably safe to make this conditional just on GCC, except for ia64
140 register window-flushing. */
a8f77aaa
GM
141/* Don't use #cpu here since in newest development versions of GCC,
142 we must call cpp with -traditional, and that disables #cpu. */
e7b6b572
DL
143#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
144 || defined __alpha__ || defined __mips__ || defined __s390__ \
e3177e43 145 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
00f37552 146 || defined __ia64__ || defined __sh__
bb15bd9a 147#define GC_SETJMP_WORKS 1
ecf4d726 148#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
72bba9f2
AS
149#ifdef __mc68000__
150#define GC_LISP_OBJECT_ALIGNMENT 2
151#endif
e3177e43
AS
152#ifdef __ia64__
153#define GC_MARK_SECONDARY_STACK() \
154 do { \
155 extern void *__libc_ia64_register_backing_store_base; \
156 __builtin_ia64_flushrs (); \
157 mark_memory (__libc_ia64_register_backing_store_base, \
2adb6e85 158 __builtin_ia64_bsp ()); \
e3177e43
AS
159 } while (0)
160#endif
bb15bd9a 161#endif