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