]> code.delx.au - gnu-emacs/blob - src/s/gnu-linux.h
Emulate POSIX_SIGNALS on MS-Windows.
[gnu-emacs] / src / s / gnu-linux.h
1 /* This file is the configuration file for Linux-based GNU systems
2 Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004,
3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4
5 This file is part of GNU Emacs.
6
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* This file was put together by Michael K. Johnson and Rik Faith. */
21
22
23 /*
24 * Define symbols to identify the version of Unix this is.
25 * Define all the symbols that apply correctly.
26 */
27
28 #define USG
29 #define GNU_LINUX
30
31 /* SYSTEM_TYPE should indicate the kind of system you are using.
32 It sets the Lisp variable system-type. */
33
34 #define SYSTEM_TYPE "gnu/linux" /* All the best software is free. */
35
36 #ifndef NOT_C_CODE
37 #ifdef emacs
38 #ifdef HAVE_LINUX_VERSION_H
39 #include <linux/version.h>
40
41 #if LINUX_VERSION_CODE >= 0x20400
42 /* 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works. */
43 #define SIGNALS_VIA_CHARACTERS
44 #endif /* LINUX_VERSION_CODE >= 0x20400 */
45 #endif /* HAVE_LINUX_VERSION_H */
46 #endif /* emacs */
47 #endif /* NOT_C_CODE */
48
49 #if defined HAVE_GRANTPT
50 #define UNIX98_PTYS
51
52 /* Run only once. We need a `for'-loop because the code uses
53 `continue'. */
54
55 #define PTY_ITERATION for (i = 0; i < 1; i++)
56
57 #ifdef HAVE_GETPT
58 #define PTY_NAME_SPRINTF
59 #define PTY_OPEN fd = getpt ()
60 #else /* not HAVE_GETPT */
61 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
62 #endif /* not HAVE_GETPT */
63
64 /* Note that grantpt and unlockpt may fork. We must block SIGCHLD to
65 prevent sigchld_handler from intercepting the child's death. */
66
67 #define PTY_TTY_NAME_SPRINTF \
68 { \
69 char *ptyname; \
70 \
71 sigblock (sigmask (SIGCHLD)); \
72 if (grantpt (fd) == -1 || unlockpt (fd) == -1 \
73 || !(ptyname = ptsname(fd))) \
74 { \
75 sigunblock (sigmask (SIGCHLD)); \
76 close (fd); \
77 return -1; \
78 } \
79 strncpy (pty_name, ptyname, sizeof (pty_name)); \
80 pty_name[sizeof (pty_name) - 1] = 0; \
81 sigunblock (sigmask (SIGCHLD)); \
82 }
83
84 #else /* not HAVE_GRANTPT */
85
86 /* Letter to use in finding device name of first pty,
87 if system supports pty's. 'p' means it is /dev/ptyp0 */
88
89 #define FIRST_PTY_LETTER 'p'
90
91 #endif /* not HAVE_GRANTPT */
92
93 /* Define HAVE_TERMIOS if the system provides POSIX-style
94 functions and macros for terminal control. */
95
96 #define HAVE_TERMIOS
97
98 /* Define HAVE_PTYS if the system supports pty devices. */
99
100 #define HAVE_PTYS
101
102 #define HAVE_SOCKETS
103
104 /* Define this symbol if your system has the functions bcopy, etc. */
105
106 #define BSTRING
107
108 /* This is used in list_system_processes. */
109 #define HAVE_PROCFS 1
110
111 /* define MAIL_USE_FLOCK if the mailer uses flock
112 to interlock access to /usr/spool/mail/$USER.
113 The alternative is that a lock file named
114 /usr/spool/mail/$USER.lock. */
115
116 /* On GNU/Linux systems, both methods are used by various mail
117 programs. I assume that most people are using newer mailers that
118 have heard of flock. Change this if you need to. */
119 /* Debian contains a patch which says: ``On Debian/GNU/Linux systems,
120 configure gets the right answers, and that means *NOT* using flock.
121 Using flock is guaranteed to be the wrong thing. See Debian Policy
122 for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the
123 Debian maintainer hasn't provided a clean fix for Emacs.
124 movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
125 HAVE_MAILLOCK_H are defined, so the following appears to be the
126 correct logic. -- fx */
127 /* We must check for HAVE_LIBLOCKFILE too, as movemail does.
128 liblockfile is a Free Software replacement for libmail, used on
129 Debian systems and elsewhere. -rfr */
130
131 #if !((defined (HAVE_LIBMAIL) || defined (HAVE_LIBLOCKFILE)) && \
132 defined (HAVE_MAILLOCK_H))
133 #define MAIL_USE_FLOCK
134 #endif
135
136 /* Define CLASH_DETECTION if you want lock files to be written
137 so that Emacs can tell instantly when you try to modify
138 a file that someone else has modified in his Emacs. */
139
140 #define CLASH_DETECTION
141
142 /* Here, on a separate page, add any special hacks needed
143 to make Emacs work on this system. For example,
144 you might define certain system call names that don't
145 exist on your system, or that do different things on
146 your system and must be used only through an encapsulation
147 (Which you should place, by convention, in sysdep.c). */
148 \f
149 /* This is needed for dispnew.c:update_frame */
150
151 #ifdef emacs
152 #include <stdio.h> /* Get the definition of _IO_STDIO_H. */
153 #if defined(_IO_STDIO_H) || defined(_STDIO_USES_IOSTREAM)
154 /* new C libio names */
155 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
156 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
157 #elif defined (__UCLIBC__)
158 /* using the uClibc library */
159 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
160 ((FILE)->__bufpos - (FILE)->__bufstart)
161 #else /* !_IO_STDIO_H && ! __UCLIBC__ */
162 /* old C++ iostream names */
163 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
164 ((FILE)->_pptr - (FILE)->_pbase)
165 #endif /* !_IO_STDIO_H && ! __UCLIBC__ */
166 #endif /* emacs */
167
168 /* Ask GCC where to find libgcc.a. */
169 #define LIB_GCC `$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`
170
171 #define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o
172
173 /* Here is how to find X Windows. LD_SWITCH_X_SITE_AUX gives an -R option
174 says where to find X windows at run time. */
175
176 #ifdef __mips__
177 #define LD_SWITCH_SYSTEM -G 0 LD_SWITCH_X_SITE_AUX
178 #else
179 #define LD_SWITCH_SYSTEM LD_SWITCH_X_SITE_AUX
180 #endif /* __mips__ */
181
182 #ifdef emacs
183 #define INTERRUPT_INPUT
184 #endif
185
186 #define SYSV_SYSTEM_DIR /* use dirent.h */
187
188 #define POSIX /* affects getpagesize.h and systty.h */
189 #define POSIX_SIGNALS
190
191 #undef LIB_GCC
192 #define LIB_GCC
193 #define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o
194
195 /* _BSD_SOURCE is redundant, at least in glibc2, since we define
196 _GNU_SOURCE. Left in in case it's relevant to libc5 systems and
197 anyone's still using Emacs on those. --fx 2002-12-14 */
198 /* #define C_SWITCH_SYSTEM -D_BSD_SOURCE */
199
200 #ifdef HAVE_LIBNCURSES
201 #define TERMINFO
202 #define LIBS_TERMCAP -lncurses
203 #endif
204
205 #define UNEXEC unexelf.o
206
207 /* This is to work around mysterious gcc failures in some system versions.
208 It is unlikely that Emacs changes will work around this problem;
209 therefore, this should remain permanently. */
210 #ifndef HAVE_XRMSETDATABASE
211 #define HAVE_XRMSETDATABASE
212 #endif
213
214 /* Use BSD process groups, but use setpgid() instead of setpgrp() to
215 actually set a process group. */
216 /* Interesting: only GNU/Linux defines this, but the BSDs do not... */
217 /* #define BSD_PGRPS */
218
219 #define NARROWPROTO 1
220
221 /* Use mmap directly for allocating larger buffers. */
222 #ifdef DOUG_LEA_MALLOC
223 #undef REL_ALLOC
224 #endif
225
226 /* Tell that garbage collector that setjmp is known to save all
227 registers relevant for conservative garbage collection in the
228 jmp_buf. */
229 /* Not all the architectures are tested, but there are Debian packages
230 for SCM and/or Guile on them, so the technique must work. See also
231 comments in alloc.c concerning setjmp and gcc. Fixme: it's
232 probably safe to make this conditional just on GCC, except for ia64
233 register window-flushing. */
234 /* Don't use #cpu here since in newest development versions of GCC,
235 we must call cpp with -traditional, and that disables #cpu. */
236
237 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
238 || defined __alpha__ || defined __mips__ || defined __s390__ \
239 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
240 || defined __ia64__ || defined __sh__
241 #define GC_SETJMP_WORKS 1
242 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
243 #ifdef __mc68000__
244 #define GC_LISP_OBJECT_ALIGNMENT 2
245 #endif
246 #ifdef __ia64__
247 #define GC_MARK_SECONDARY_STACK() \
248 do { \
249 extern void *__libc_ia64_register_backing_store_base; \
250 __builtin_ia64_flushrs (); \
251 mark_memory (__libc_ia64_register_backing_store_base, \
252 __builtin_ia64_bsp (), 0); \
253 } while (0)
254 #endif
255 #endif
256
257 /* arch-tag: 6244ea2a-abd0-44ec-abec-ff3dcc9afea9
258 (do not change this comment) */