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