Move SYSTEM_TYPE from src/s to configure
[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 27
65953053 28#ifdef emacs
b764619d 29#ifdef HAVE_LINUX_VERSION_H
65953053 30#include <linux/version.h>
566e3587 31
85a71b37 32#if LINUX_VERSION_CODE >= 0x20400
c5e7567d
DN
33/* 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works. */
34#define SIGNALS_VIA_CHARACTERS
85a71b37 35#endif /* LINUX_VERSION_CODE >= 0x20400 */
b764619d 36#endif /* HAVE_LINUX_VERSION_H */
aa7fcbb0 37#endif /* emacs */
566e3587 38
71125fb8
GM
39#if defined HAVE_GRANTPT
40#define UNIX98_PTYS
566e3587 41
e05aebe9 42/* Run only once. We need a `for'-loop because the code uses `continue'. */
be02381c 43#define PTY_ITERATION int i; for (i = 0; i < 1; i++)
fdc5e0fc 44
71125fb8
GM
45#ifdef HAVE_GETPT
46#define PTY_NAME_SPRINTF
47#define PTY_OPEN fd = getpt ()
48#else /* not HAVE_GETPT */
49#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
50#endif /* not HAVE_GETPT */
51
52/* Note that grantpt and unlockpt may fork. We must block SIGCHLD to
53 prevent sigchld_handler from intercepting the child's death. */
71125fb8
GM
54#define PTY_TTY_NAME_SPRINTF \
55 { \
56 char *ptyname; \
57 \
58 sigblock (sigmask (SIGCHLD)); \
59 if (grantpt (fd) == -1 || unlockpt (fd) == -1 \
60 || !(ptyname = ptsname(fd))) \
61 { \
62 sigunblock (sigmask (SIGCHLD)); \
63 close (fd); \
64 return -1; \
65 } \
66 strncpy (pty_name, ptyname, sizeof (pty_name)); \
67 pty_name[sizeof (pty_name) - 1] = 0; \
68 sigunblock (sigmask (SIGCHLD)); \
69 }
fdc5e0fc 70
dacbb818 71#else /* not HAVE_GRANTPT */
fdc5e0fc 72
71125fb8
GM
73/* Letter to use in finding device name of first pty,
74 if system supports pty's. 'p' means it is /dev/ptyp0 */
71125fb8 75#define FIRST_PTY_LETTER 'p'
fdc5e0fc 76
132d0475 77#endif /* not HAVE_GRANTPT */
fdc5e0fc 78
e05aebe9 79/* Define HAVE_PTYS if the system supports pty devices. */
566e3587
JB
80#define HAVE_PTYS
81
dad29761 82#define HAVE_SOCKETS
566e3587 83
06e111a6 84/* This is used in list_system_processes. */
40c5931c 85#define HAVE_PROCFS 1
40c5931c 86
566e3587
JB
87/* Define CLASH_DETECTION if you want lock files to be written
88 so that Emacs can tell instantly when you try to modify
89 a file that someone else has modified in his Emacs. */
b2e209ba 90#define CLASH_DETECTION
566e3587
JB
91
92/* Here, on a separate page, add any special hacks needed
93 to make Emacs work on this system. For example,
94 you might define certain system call names that don't
95 exist on your system, or that do different things on
96 your system and must be used only through an encapsulation
97 (Which you should place, by convention, in sysdep.c). */
98\f
e05aebe9 99/* This is needed for dispnew.c:update_frame. */
5e5623c2 100#ifdef emacs
a9c82aaf 101#include <stdio.h> /* Get the definition of _IO_STDIO_H. */
5e617bc2 102#if defined (_IO_STDIO_H) || defined (_STDIO_USES_IOSTREAM)
e05aebe9 103/* New C libio names. */
c2c3f859 104#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
5e5623c2 105 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
65f451d0 106#elif defined (__UCLIBC__)
e05aebe9 107/* Using the uClibc library. */
65f451d0
DN
108#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
109 ((FILE)->__bufpos - (FILE)->__bufstart)
110#else /* !_IO_STDIO_H && ! __UCLIBC__ */
e05aebe9 111/* Old C++ iostream names. */
c2c3f859 112#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
5e5623c2 113 ((FILE)->_pptr - (FILE)->_pbase)
65f451d0 114#endif /* !_IO_STDIO_H && ! __UCLIBC__ */
566e3587 115
65953053 116#define INTERRUPT_INPUT
9539dc5d 117#endif /* emacs */
566e3587 118
1abbab7a 119#define POSIX /* affects getpagesize.h and systty.h */
566e3587 120
639f52d8
RS
121/* This is to work around mysterious gcc failures in some system versions.
122 It is unlikely that Emacs changes will work around this problem;
123 therefore, this should remain permanently. */
e3b89505
RS
124#ifndef HAVE_XRMSETDATABASE
125#define HAVE_XRMSETDATABASE
126#endif
e2000885 127
2327e4a0
GM
128#define NARROWPROTO 1
129
bb15bd9a 130/* Tell that garbage collector that setjmp is known to save all
e05aebe9 131 registers relevant for conservative garbage collection in the jmp_buf. */
e7b6b572
DL
132/* Not all the architectures are tested, but there are Debian packages
133 for SCM and/or Guile on them, so the technique must work. See also
134 comments in alloc.c concerning setjmp and gcc. Fixme: it's
135 probably safe to make this conditional just on GCC, except for ia64
136 register window-flushing. */
a8f77aaa
GM
137/* Don't use #cpu here since in newest development versions of GCC,
138 we must call cpp with -traditional, and that disables #cpu. */
e7b6b572
DL
139#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
140 || defined __alpha__ || defined __mips__ || defined __s390__ \
e3177e43 141 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
00f37552 142 || defined __ia64__ || defined __sh__
bb15bd9a 143#define GC_SETJMP_WORKS 1
e3177e43
AS
144#ifdef __ia64__
145#define GC_MARK_SECONDARY_STACK() \
146 do { \
147 extern void *__libc_ia64_register_backing_store_base; \
148 __builtin_ia64_flushrs (); \
149 mark_memory (__libc_ia64_register_backing_store_base, \
2adb6e85 150 __builtin_ia64_bsp ()); \
e3177e43
AS
151 } while (0)
152#endif
b948ce8b
PE
153#else
154#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
bb15bd9a 155#endif
34374650
PE
156
157#ifdef __i386__
158/* libc-linux/sysdeps/linux/i386/ulimit.c says that due to shared library, */
159/* we cannot get the maximum address for brk */
160# define ULIMIT_BREAK_VALUE (32*1024*1024)
161#endif