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