* syswait.h: Remove old if 0 code. Do not define WAITTYPE, it was
[bpt/emacs.git] / 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 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 UNIPLUS */
29 /* #define USG5 */
30 #define USG
31 /* #define BSD_SYSTEM */
32 #define LINUX
33 #define GNU_LINUX
34
35 /* SYSTEM_TYPE should indicate the kind of system you are using.
36 It sets the Lisp variable system-type. */
37
38 #define SYSTEM_TYPE "gnu/linux" /* All the best software is free. */
39
40 #ifndef NOT_C_CODE
41 #ifdef emacs
42 #ifdef HAVE_LINUX_VERSION_H
43 #include <linux/version.h>
44
45 #if LINUX_VERSION_CODE >= 0x20400
46 /* 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works. */
47 #define SIGNALS_VIA_CHARACTERS
48 #endif /* LINUX_VERSION_CODE >= 0x20400 */
49 #endif /* HAVE_LINUX_VERSION_H */
50 #endif /* emacs */
51 #endif /* NOT_C_CODE */
52
53 #if defined HAVE_GRANTPT
54 #define UNIX98_PTYS
55
56 /* Run only once. We need a `for'-loop because the code uses
57 `continue'. */
58
59 #define PTY_ITERATION for (i = 0; i < 1; i++)
60
61 #ifdef HAVE_GETPT
62 #define PTY_NAME_SPRINTF
63 #define PTY_OPEN fd = getpt ()
64 #else /* not HAVE_GETPT */
65 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
66 #endif /* not HAVE_GETPT */
67
68 /* Note that grantpt and unlockpt may fork. We must block SIGCHLD to
69 prevent sigchld_handler from intercepting the child's death. */
70
71 #define PTY_TTY_NAME_SPRINTF \
72 { \
73 char *ptyname; \
74 \
75 sigblock (sigmask (SIGCHLD)); \
76 if (grantpt (fd) == -1 || unlockpt (fd) == -1 \
77 || !(ptyname = ptsname(fd))) \
78 { \
79 sigunblock (sigmask (SIGCHLD)); \
80 close (fd); \
81 return -1; \
82 } \
83 strncpy (pty_name, ptyname, sizeof (pty_name)); \
84 pty_name[sizeof (pty_name) - 1] = 0; \
85 sigunblock (sigmask (SIGCHLD)); \
86 }
87
88 #else /* not HAVE_GRANTPT */
89
90 /* Letter to use in finding device name of first pty,
91 if system supports pty's. 'p' means it is /dev/ptyp0 */
92
93 #define FIRST_PTY_LETTER 'p'
94
95 #endif /* not HAVE_GRANDPT */
96
97 /* Define HAVE_TERMIOS if the system provides POSIX-style
98 functions and macros for terminal control. */
99
100 #define HAVE_TERMIOS
101
102 /* Define HAVE_PTYS if the system supports pty devices. */
103
104 #define HAVE_PTYS
105
106 #define HAVE_SOCKETS
107
108 /* Define this symbol if your system has the functions bcopy, etc. */
109
110 #define BSTRING
111
112 /* subprocesses should be defined if you want to
113 have code for asynchronous subprocesses
114 (as used in M-x compile and M-x shell).
115 This is generally OS dependent, and not supported
116 under most USG systems. */
117
118 #define subprocesses
119
120 /* define MAIL_USE_FLOCK if the mailer uses flock
121 to interlock access to /usr/spool/mail/$USER.
122 The alternative is that a lock file named
123 /usr/spool/mail/$USER.lock. */
124
125 /* On GNU/Linux systems, both methods are used by various mail
126 programs. I assume that most people are using newer mailers that
127 have heard of flock. Change this if you need to. */
128 /* Debian contains a patch which says: ``On Debian/GNU/Linux systems,
129 configure gets the right answers, and that means *NOT* using flock.
130 Using flock is guaranteed to be the wrong thing. See Debian Policy
131 for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the
132 Debian maintainer hasn't provided a clean fix for Emacs.
133 movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
134 HAVE_MAILLOCK_H are defined, so the following appears to be the
135 correct logic. -- fx */
136 /* We must check for HAVE_LIBLOCKFILE too, as movemail does.
137 liblockfile is a Free Software replacement for libmail, used on
138 Debian systems and elsewhere. -rfr */
139
140 #if !((defined (HAVE_LIBMAIL) || defined (HAVE_LIBLOCKFILE)) && \
141 defined (HAVE_MAILLOCK_H))
142 #define MAIL_USE_FLOCK
143 #endif
144
145 /* Define CLASH_DETECTION if you want lock files to be written
146 so that Emacs can tell instantly when you try to modify
147 a file that someone else has modified in his Emacs. */
148
149 #define CLASH_DETECTION
150
151 /* Here, on a separate page, add any special hacks needed
152 to make Emacs work on this system. For example,
153 you might define certain system call names that don't
154 exist on your system, or that do different things on
155 your system and must be used only through an encapsulation
156 (Which you should place, by convention, in sysdep.c). */
157 \f
158 /* If you mount the proc file system somewhere other than /proc
159 you will have to uncomment the following and make the proper
160 changes */
161
162 /* #define LINUX_LDAV_FILE "/proc/loadavg" */
163
164 /* This is needed for dispnew.c:update_frame */
165
166 #ifdef emacs
167 #include <stdio.h> /* Get the definition of _IO_STDIO_H. */
168 #if defined(_IO_STDIO_H) || defined(_STDIO_USES_IOSTREAM)
169 /* new C libio names */
170 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
171 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
172 #else /* !_IO_STDIO_H */
173 /* old C++ iostream names */
174 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
175 ((FILE)->_pptr - (FILE)->_pbase)
176 #endif /* !_IO_STDIO_H */
177 #endif /* emacs */
178
179 /* Ask GCC where to find libgcc.a. */
180 #define LIB_GCC `$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`
181
182 #define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
183
184 /* Here is how to find X Windows. LD_SWITCH_X_SITE_AUX gives an -R option
185 says where to find X windows at run time. */
186
187 #ifdef __mips__
188 #define LD_SWITCH_SYSTEM -G 0 LD_SWITCH_X_SITE_AUX
189 #else
190 #define LD_SWITCH_SYSTEM LD_SWITCH_X_SITE_AUX
191 #endif /* __mips__ */
192
193 /* Link temacs with -z nocombreloc so that unexec works right, whether or
194 not -z combreloc is the default. GNU ld ignores unknown -z KEYWORD
195 switches, so this also works with older versions that don't implement
196 -z combreloc. */
197 #define LD_SWITCH_SYSTEM_TEMACS -z nocombreloc
198
199 #ifdef emacs
200 #define INTERRUPT_INPUT
201 #endif
202
203 /* This is needed for sysdep.c */
204
205 #define NO_SIOCTL_H /* don't have sioctl.h */
206
207 #define SYSV_SYSTEM_DIR /* use dirent.h */
208
209 #define POSIX /* affects getpagesize.h and systty.h */
210 #define POSIX_SIGNALS
211
212 /* Best not to include -lg, unless it is last on the command line */
213 #define LIBS_DEBUG
214 #undef LIB_GCC
215 #define LIB_GCC
216 #define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
217
218 /* Don't use -g in test compiles in configure.
219 This is so we will use the same shared libs for that linking
220 that are used when linking temacs. */
221 #ifdef THIS_IS_CONFIGURE
222 #define C_DEBUG_SWITCH
223 #endif
224
225 /* Rob Malouf <malouf@csli.stanford.edu> says:
226 SYSV IPC is standard a standard part of Linux since version 0.99pl10,
227 and is a very common addition to previous versions. */
228
229 #ifdef TERM
230 #define LIBS_SYSTEM -lclient
231 #define C_SWITCH_SYSTEM -D_BSD_SOURCE -I/usr/src/term
232 #else
233 /* alane@wozzle.linet.org says that -lipc is not a separate library,
234 since libc-4.4.1. So -lipc was deleted. */
235 #define LIBS_SYSTEM
236 /* _BSD_SOURCE is redundant, at least in glibc2, since we define
237 _GNU_SOURCE. Left in in case it's relevant to libc5 systems and
238 anyone's still using Emacs on those. --fx 2002-12-14 */
239 #define C_SWITCH_SYSTEM -D_BSD_SOURCE
240 #endif
241
242 /* Paul Abrahams <abrahams@equinox.shaysnet.com> says this is needed. */
243 #define LIB_MOTIF -lXm -lXpm
244
245 #ifdef HAVE_LIBNCURSES
246 #define TERMINFO
247 #define LIBS_TERMCAP -lncurses
248 #endif
249
250 #define HAVE_SYSVIPC
251
252 #define UNEXEC unexelf.o
253
254 #define A_TEXT_OFFSET(hdr) (N_MAGIC(hdr) == QMAGIC ? sizeof (struct exec) : 0)
255 #define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr))
256 #define ADJUST_EXEC_HEADER \
257 unexec_text_start = N_TXTADDR(ohdr) + A_TEXT_OFFSET(ohdr)
258
259 /* This is to work around mysterious gcc failures in some system versions.
260 It is unlikely that Emacs changes will work around this problem;
261 therefore, this should remain permanently. */
262 #ifndef HAVE_XRMSETDATABASE
263 #define HAVE_XRMSETDATABASE
264 #endif
265
266 /* Use BSD process groups, but use setpgid() instead of setpgrp() to
267 actually set a process group. */
268
269 #define BSD_PGRPS
270
271 #define NARROWPROTO 1
272
273 /* Use mmap directly for allocating larger buffers. */
274 #ifdef DOUG_LEA_MALLOC
275 #undef REL_ALLOC
276 #endif
277
278 /* Tell that garbage collector that setjmp is known to save all
279 registers relevant for conservative garbage collection in the
280 jmp_buf. */
281 /* Not all the architectures are tested, but there are Debian packages
282 for SCM and/or Guile on them, so the technique must work. See also
283 comments in alloc.c concerning setjmp and gcc. Fixme: it's
284 probably safe to make this conditional just on GCC, except for ia64
285 register window-flushing. */
286 /* Don't use #cpu here since in newest development versions of GCC,
287 we must call cpp with -traditional, and that disables #cpu. */
288
289 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
290 || defined __alpha__ || defined __mips__ || defined __s390__ \
291 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
292 || defined __ia64__
293 #define GC_SETJMP_WORKS 1
294 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
295 #ifdef __mc68000__
296 #define GC_LISP_OBJECT_ALIGNMENT 2
297 #endif
298 #ifdef __ia64__
299 #define GC_MARK_SECONDARY_STACK() \
300 do { \
301 extern void *__libc_ia64_register_backing_store_base; \
302 __builtin_ia64_flushrs (); \
303 mark_memory (__libc_ia64_register_backing_store_base, \
304 __builtin_ia64_bsp (), 0); \
305 } while (0)
306 #endif
307 #endif
308
309 /* arch-tag: 6244ea2a-abd0-44ec-abec-ff3dcc9afea9
310 (do not change this comment) */