Merge from trunk
[bpt/emacs.git] / src / s / gnu-linux.h
1 /* This file is the configuration file for Linux-based GNU systems
2
3 Copyright (C) 1985-1986, 1992, 1994, 1996, 1999, 2001-2012
4 Free Software Foundation, Inc.
5
6 This file was put together by Michael K. Johnson and Rik Faith.
7
8 This file is part of GNU Emacs.
9
10 GNU Emacs is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 GNU Emacs is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22
23 /* Define symbols to identify the version of Unix this is.
24 Define all the symbols that apply correctly. */
25 #define USG
26 #define GNU_LINUX
27
28 #ifdef emacs
29 #ifdef HAVE_LINUX_VERSION_H
30 #include <linux/version.h>
31
32 #if LINUX_VERSION_CODE >= 0x20400
33 /* 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works. */
34 #define SIGNALS_VIA_CHARACTERS
35 #endif /* LINUX_VERSION_CODE >= 0x20400 */
36 #endif /* HAVE_LINUX_VERSION_H */
37 #endif /* emacs */
38
39 #if defined HAVE_GRANTPT
40 #define UNIX98_PTYS
41
42 /* Run only once. We need a `for'-loop because the code uses `continue'. */
43 #define PTY_ITERATION int i; for (i = 0; i < 1; i++)
44
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. */
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 }
70
71 #else /* not HAVE_GRANTPT */
72
73 /* Letter to use in finding device name of first pty,
74 if system supports pty's. 'p' means it is /dev/ptyp0 */
75 #define FIRST_PTY_LETTER 'p'
76
77 #endif /* not HAVE_GRANTPT */
78
79 /* Define HAVE_PTYS if the system supports pty devices. */
80 #define HAVE_PTYS
81
82 #define HAVE_SOCKETS
83
84 /* Define CLASH_DETECTION if you want lock files to be written
85 so that Emacs can tell instantly when you try to modify
86 a file that someone else has modified in his Emacs. */
87 #define CLASH_DETECTION
88
89 /* Here, on a separate page, add any special hacks needed
90 to make Emacs work on this system. For example,
91 you might define certain system call names that don't
92 exist on your system, or that do different things on
93 your system and must be used only through an encapsulation
94 (Which you should place, by convention, in sysdep.c). */
95 \f
96 /* This is needed for dispnew.c:update_frame. */
97 #ifdef emacs
98 #include <stdio.h> /* Get the definition of _IO_STDIO_H. */
99 #if defined (_IO_STDIO_H) || defined (_STDIO_USES_IOSTREAM)
100 /* New C libio names. */
101 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
102 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
103 #elif defined (__UCLIBC__)
104 /* Using the uClibc library. */
105 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
106 ((FILE)->__bufpos - (FILE)->__bufstart)
107 #else /* !_IO_STDIO_H && ! __UCLIBC__ */
108 /* Old C++ iostream names. */
109 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
110 ((FILE)->_pptr - (FILE)->_pbase)
111 #endif /* !_IO_STDIO_H && ! __UCLIBC__ */
112
113 #define INTERRUPT_INPUT
114 #endif /* emacs */
115
116 #define POSIX /* affects getpagesize.h and systty.h */
117
118 /* This is to work around mysterious gcc failures in some system versions.
119 It is unlikely that Emacs changes will work around this problem;
120 therefore, this should remain permanently. */
121 #ifndef HAVE_XRMSETDATABASE
122 #define HAVE_XRMSETDATABASE
123 #endif
124
125 #define NARROWPROTO 1
126
127 /* Tell that garbage collector that setjmp is known to save all
128 registers relevant for conservative garbage collection in the jmp_buf. */
129 /* Not all the architectures are tested, but there are Debian packages
130 for SCM and/or Guile on them, so the technique must work. See also
131 comments in alloc.c concerning setjmp and gcc. Fixme: it's
132 probably safe to make this conditional just on GCC, except for ia64
133 register window-flushing. */
134 /* Don't use #cpu here since in newest development versions of GCC,
135 we must call cpp with -traditional, and that disables #cpu. */
136 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
137 || defined __alpha__ || defined __mips__ || defined __s390__ \
138 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
139 || defined __ia64__ || defined __sh__
140 #define GC_SETJMP_WORKS 1
141 #ifdef __ia64__
142 #define GC_MARK_SECONDARY_STACK() \
143 do { \
144 extern void *__libc_ia64_register_backing_store_base; \
145 __builtin_ia64_flushrs (); \
146 mark_memory (__libc_ia64_register_backing_store_base, \
147 __builtin_ia64_bsp ()); \
148 } while (0)
149 #endif
150 #else
151 #define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
152 #endif
153
154 #ifdef __i386__
155 /* libc-linux/sysdeps/linux/i386/ulimit.c says that due to shared library, */
156 /* we cannot get the maximum address for brk */
157 # define ULIMIT_BREAK_VALUE (32*1024*1024)
158 #endif