]> code.delx.au - gnu-emacs/blob - src/s/gnu-linux.h
f9a95e5672c5ebb7f68c3246ab1bbbd57ea369ab
[gnu-emacs] / src / s / gnu-linux.h
1 /* This file is the configuration file for Linux-based GNU systems
2 Copyright (C) 1985, 86, 92, 94, 96, 1999 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* This file was put together by Michael K. Johnson and Rik Faith. */
22
23
24 /*
25 * Define symbols to identify the version of Unix this is.
26 * Define all the symbols that apply correctly.
27 */
28
29 /* #define UNIPLUS */
30 /* #define USG5 */
31 #define USG
32 /* #define BSD_SYSTEM */
33 #define 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 /* Check the version number of Linux--if it is at least 1.2.0,
41 it is safe to use SIGIO. */
42 #ifndef NOT_C_CODE
43 #ifdef emacs
44 #ifdef HAVE_LINUX_VERSION_H
45 #include <linux/version.h>
46
47 #if LINUX_VERSION_CODE > 0x10200
48 #define LINUX_SIGIO_DOES_WORK
49 #endif /* LINUX_VERSION_CODE > 0x10200 */
50 #if LINUX_VERSION_CODE >= 0x20000
51 #define LINUX_MAP_SHARED_DOES_WORK
52 #endif /* LINUX_VERSION_CODE >= 0x20000 */
53 #endif /* HAVE_LINUX_VERSION_H */
54 #endif /* emacs */
55 #endif /* NOT_C_CODE */
56
57 #if defined HAVE_GRANTPT
58 #define UNIX98_PTYS
59
60 /* Run only once. We need a `for'-loop because the code uses
61 `continue'. */
62
63 #define PTY_ITERATION for (i = 0; i < 1; i++)
64
65 #ifdef HAVE_GETPT
66 #define PTY_NAME_SPRINTF
67 #define PTY_OPEN fd = getpt ()
68 #else /* not HAVE_GETPT */
69 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
70 #endif /* not HAVE_GETPT */
71
72 /* Note that grantpt and unlockpt may fork. We must block SIGCHLD to
73 prevent sigchld_handler from intercepting the child's death. */
74
75 #define PTY_TTY_NAME_SPRINTF \
76 { \
77 char *ptyname; \
78 \
79 sigblock (sigmask (SIGCHLD)); \
80 if (grantpt (fd) == -1 || unlockpt (fd) == -1 \
81 || !(ptyname = ptsname(fd))) \
82 { \
83 sigunblock (sigmask (SIGCHLD)); \
84 close (fd); \
85 return -1; \
86 } \
87 strncpy (pty_name, ptyname, sizeof (pty_name)); \
88 pty_name[sizeof (pty_name) - 1] = 0; \
89 sigunblock (sigmask (SIGCHLD)); \
90 }
91
92 #else /* not HAVE_GRANTPT */
93
94 /* Letter to use in finding device name of first pty,
95 if system supports pty's. 'p' means it is /dev/ptyp0 */
96
97 #define FIRST_PTY_LETTER 'p'
98
99 #endif /* not HAVE_GRANDPT */
100
101 /* Define HAVE_TERMIOS if the system provides POSIX-style
102 functions and macros for terminal control. */
103
104 #define HAVE_TERMIOS
105
106 /* Define HAVE_PTYS if the system supports pty devices. */
107
108 #define HAVE_PTYS
109
110 #define HAVE_SOCKETS
111
112 /* Define this symbol if your system has the functions bcopy, etc. */
113
114 #define BSTRING
115
116 /* subprocesses should be defined if you want to
117 have code for asynchronous subprocesses
118 (as used in M-x compile and M-x shell).
119 This is generally OS dependent, and not supported
120 under most USG systems. */
121
122 #define subprocesses
123
124 /* define MAIL_USE_FLOCK if the mailer uses flock
125 to interlock access to /usr/spool/mail/$USER.
126 The alternative is that a lock file named
127 /usr/spool/mail/$USER.lock. */
128
129 /* On GNU/Linux systems, both methods are used by various mail
130 programs. I assume that most people are using newer mailers that
131 have heard of flock. Change this if you need to. */
132
133 #define MAIL_USE_FLOCK
134
135 /* Define CLASH_DETECTION if you want lock files to be written
136 so that Emacs can tell instantly when you try to modify
137 a file that someone else has modified in his Emacs. */
138
139 #define CLASH_DETECTION
140
141 /* Here, on a separate page, add any special hacks needed
142 to make Emacs work on this system. For example,
143 you might define certain system call names that don't
144 exist on your system, or that do different things on
145 your system and must be used only through an encapsulation
146 (Which you should place, by convention, in sysdep.c). */
147 \f
148 /* If you mount the proc file system somewhere other than /proc
149 you will have to uncomment the following and make the proper
150 changes */
151
152 /* #define LINUX_LDAV_FILE "/proc/loadavg" */
153
154 /* This is needed for dispnew.c:update_frame */
155
156 #ifdef emacs
157 #include <stdio.h> /* Get the definition of _IO_STDIO_H. */
158 #if defined(_IO_STDIO_H) || defined(_STDIO_USES_IOSTREAM)
159 /* new C libio names */
160 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
161 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
162 #else /* !_IO_STDIO_H */
163 /* old C++ iostream names */
164 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
165 ((FILE)->_pptr - (FILE)->_pbase)
166 #endif /* !_IO_STDIO_H */
167 #endif /* emacs */
168
169 /* Ask GCC where to find libgcc.a. */
170 #define LIB_GCC `$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`
171
172 #ifndef __ELF__
173 /* GNU/Linux usually has crt0.o in a non-standard place */
174 #define START_FILES pre-crt0.o /usr/lib/crt0.o
175 #else
176 #define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
177 #endif
178
179 #ifdef __ELF__
180 /* Here is how to find X Windows. LD_SWITCH_X_SITE_AUX gives an -R option
181 says where to find X windows at run time. */
182
183 #ifdef __mips__
184 #define LD_SWITCH_SYSTEM -G 0 LD_SWITCH_X_SITE_AUX
185 #else
186 #define LD_SWITCH_SYSTEM LD_SWITCH_X_SITE_AUX
187 #endif /* __mips__ */
188
189 /* Link temacs with -z nocombreloc so that unexec works right, whether or
190 not -z combreloc is the default. GNU ld ignores unknown -z KEYOWRD
191 switches, so this also works with older versions that don't implement
192 -z combreloc. */
193 #define LD_SWITCH_SYSTEM_TEMACS -z nocombreloc
194 #endif /* __ELF__ */
195
196 /* As of version 1.1.51, Linux did not actually implement SIGIO.
197 But it works in newer versions. */
198 #ifdef emacs
199 #ifdef LINUX_SIGIO_DOES_WORK
200 #define INTERRUPT_INPUT
201 #else
202 #define BROKEN_SIGIO
203 /* Some versions of Linux define SIGURG and SIGPOLL as aliases for SIGIO.
204 This prevents lossage in process.c. */
205 #define BROKEN_SIGURG
206 #define BROKEN_SIGPOLL
207 #endif
208 #endif
209
210 /* This is needed for sysdep.c */
211
212 #define NO_SIOCTL_H /* don't have sioctl.h */
213
214 #define HAVE_WAIT_HEADER
215
216 #define SYSV_SYSTEM_DIR /* use dirent.h */
217
218 #define POSIX /* affects getpagesize.h and systty.h */
219 #define POSIX_SIGNALS
220
221 /* Best not to include -lg, unless it is last on the command line */
222 #define LIBS_DEBUG
223 #ifndef __ELF__
224 #define LIB_STANDARD -lc /* avoid -lPW */
225 #else
226 #undef LIB_GCC
227 #define LIB_GCC
228 #define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
229 #endif
230
231 /* Don't use -g in test compiles in configure.
232 This is so we will use the same shared libs for that linking
233 that are used when linking temacs. */
234 #ifdef THIS_IS_CONFIGURE
235 #define C_DEBUG_SWITCH
236 #endif
237
238 /* Let's try this out, just in case.
239 Nah. Rik Faith <faith@cs.unc.edu> says it doesn't work well. */
240 /* #define SIGNALS_VIA_CHARACTERS */
241
242 /* Rob Malouf <malouf@csli.stanford.edu> says:
243 SYSV IPC is standard a standard part of Linux since version 0.99pl10,
244 and is a very common addition to previous versions. */
245
246 #ifdef TERM
247 #define LIBS_SYSTEM -lclient
248 #define C_SWITCH_SYSTEM -D_BSD_SOURCE -I/usr/src/term
249 #else
250 /* alane@wozzle.linet.org says that -lipc is not a separate library,
251 since libc-4.4.1. So -lipc was deleted. */
252 #define LIBS_SYSTEM
253 #define C_SWITCH_SYSTEM -D_BSD_SOURCE
254 #endif
255
256 /* Paul Abrahams <abrahams@equinox.shaysnet.com> says this is needed. */
257 #define LIB_MOTIF -lXm -lXpm
258
259 #ifdef HAVE_LIBNCURSES
260 #define TERMINFO
261 #define LIBS_TERMCAP -lncurses
262 #endif
263
264 #define HAVE_SYSVIPC
265
266 #ifdef __ELF__
267 #define UNEXEC unexelf.o
268 #ifndef LINUX_MAP_SHARED_DOES_WORK
269 #define UNEXEC_USE_MAP_PRIVATE
270 #endif
271 #endif
272
273 #ifdef LINUX_QMAGIC
274
275 #define HAVE_TEXT_START
276 #define UNEXEC unexsunos4.o
277 #define N_PAGSIZ(x) PAGE_SIZE
278
279 #else /* not LINUX_QMAGIC */
280
281 #define A_TEXT_OFFSET(hdr) (N_MAGIC(hdr) == QMAGIC ? sizeof (struct exec) : 0)
282 #define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr))
283 #define ADJUST_EXEC_HEADER \
284 unexec_text_start = N_TXTADDR(ohdr) + A_TEXT_OFFSET(ohdr)
285
286 #endif /* not LINUX_QMAGIC */
287
288 #if 0
289 /* In 19.23 and 19.24, configure sometimes fails to define these.
290 It has to do with the fact that configure uses CFLAGS when linking
291 while Makefile.in.in (erroneously) fails to do so when linking temacs. */
292 #ifndef HAVE_GETTIMEOFDAY
293 #define HAVE_GETTIMEOFDAY
294 #endif
295 #ifndef HAVE_MKDIR
296 #define HAVE_MKDIR
297 #endif
298 #ifndef HAVE_RMDIR
299 #define HAVE_RMDIR
300 #endif
301 #ifndef HAVE_XSCREENNUMBEROFSCREEN
302 #define HAVE_XSCREENNUMBEROFSCREEN
303 #endif
304 #endif /* 0 */
305
306 /* This is to work around mysterious gcc failures in some system versions.
307 It is unlikely that Emacs changes will work around this problem;
308 therefore, this should remain permanently. */
309 #ifndef HAVE_XRMSETDATABASE
310 #define HAVE_XRMSETDATABASE
311 #endif
312
313 /* The regex.o routines are a part of the GNU C-library used with Linux. */
314 /* However, sometimes they disagree with the src/regex.h that comes with Emacs,
315 and that can make trouble in etags.c because it gets the regex.h from Emacs
316 and the function definitions in libc. So turn this off. */
317 /* #define REGEXP_IN_LIBC */
318
319 /* Use BSD process groups, but use setpgid() instead of setpgrp() to
320 actually set a process group. */
321
322 #define BSD_PGRPS
323
324 #define NARROWPROTO 1
325
326 /* Use mmap directly for allocating larger buffers. */
327 #ifdef DOUG_LEA_MALLOC
328 #undef REL_ALLOC
329 #endif
330
331 /* Tell that garbage collector that setjmp is known to save all
332 registers relevant for conservative garbage collection in the
333 jmp_buf. */
334 /* m68k and alpha aren't tested, but there are Debian packages for SCM
335 and/or Guile on them, so the technique must work. */
336
337 /* Don't use #cpu here since in newest development versions of GCC,
338 we must call cpp with -traditional, and that disables #cpu. */
339
340 #if defined __i386__ || defined __sparc__ || defined __m68k__ || defined __alpha__
341 #define GC_SETJMP_WORKS 1
342 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
343 #endif