Move LD_SWITCH_X_SITE_AUX from cpp to autoconf.
[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, 2009, 2010
4 Free Software Foundation, Inc.
5
6 This file is part of GNU Emacs.
7
8 GNU Emacs is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 GNU Emacs is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
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 USG
30 #define GNU_LINUX
31
32 /* SYSTEM_TYPE should indicate the kind of system you are using.
33 It sets the Lisp variable system-type. */
34
35 #define SYSTEM_TYPE "gnu/linux" /* All the best software is free. */
36
37 #ifndef NOT_C_CODE
38 #ifdef emacs
39 #ifdef HAVE_LINUX_VERSION_H
40 #include <linux/version.h>
41
42 #if LINUX_VERSION_CODE >= 0x20400
43 /* 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works. */
44 #define SIGNALS_VIA_CHARACTERS
45 #endif /* LINUX_VERSION_CODE >= 0x20400 */
46 #endif /* HAVE_LINUX_VERSION_H */
47 #endif /* emacs */
48 #endif /* NOT_C_CODE */
49
50 #if defined HAVE_GRANTPT
51 #define UNIX98_PTYS
52
53 /* Run only once. We need a `for'-loop because the code uses
54 `continue'. */
55
56 #define PTY_ITERATION for (i = 0; i < 1; i++)
57
58 #ifdef HAVE_GETPT
59 #define PTY_NAME_SPRINTF
60 #define PTY_OPEN fd = getpt ()
61 #else /* not HAVE_GETPT */
62 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
63 #endif /* not HAVE_GETPT */
64
65 /* Note that grantpt and unlockpt may fork. We must block SIGCHLD to
66 prevent sigchld_handler from intercepting the child's death. */
67
68 #define PTY_TTY_NAME_SPRINTF \
69 { \
70 char *ptyname; \
71 \
72 sigblock (sigmask (SIGCHLD)); \
73 if (grantpt (fd) == -1 || unlockpt (fd) == -1 \
74 || !(ptyname = ptsname(fd))) \
75 { \
76 sigunblock (sigmask (SIGCHLD)); \
77 close (fd); \
78 return -1; \
79 } \
80 strncpy (pty_name, ptyname, sizeof (pty_name)); \
81 pty_name[sizeof (pty_name) - 1] = 0; \
82 sigunblock (sigmask (SIGCHLD)); \
83 }
84
85 #else /* not HAVE_GRANTPT */
86
87 /* Letter to use in finding device name of first pty,
88 if system supports pty's. 'p' means it is /dev/ptyp0 */
89
90 #define FIRST_PTY_LETTER 'p'
91
92 #endif /* not HAVE_GRANTPT */
93
94 /* Define HAVE_TERMIOS if the system provides POSIX-style
95 functions and macros for terminal control. */
96
97 #define HAVE_TERMIOS
98
99 /* Define HAVE_PTYS if the system supports pty devices. */
100
101 #define HAVE_PTYS
102
103 #define HAVE_SOCKETS
104
105 /* Define this symbol if your system has the functions bcopy, etc. */
106
107 #define BSTRING
108
109 /* This is used in list_system_processes. */
110 #define HAVE_PROCFS 1
111
112 /* define MAIL_USE_FLOCK if the mailer uses flock
113 to interlock access to /usr/spool/mail/$USER.
114 The alternative is that a lock file named
115 /usr/spool/mail/$USER.lock. */
116
117 /* On GNU/Linux systems, both methods are used by various mail
118 programs. I assume that most people are using newer mailers that
119 have heard of flock. Change this if you need to. */
120 /* Debian contains a patch which says: ``On Debian/GNU/Linux systems,
121 configure gets the right answers, and that means *NOT* using flock.
122 Using flock is guaranteed to be the wrong thing. See Debian Policy
123 for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the
124 Debian maintainer hasn't provided a clean fix for Emacs.
125 movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
126 HAVE_MAILLOCK_H are defined, so the following appears to be the
127 correct logic. -- fx */
128 /* We must check for HAVE_LIBLOCKFILE too, as movemail does.
129 liblockfile is a Free Software replacement for libmail, used on
130 Debian systems and elsewhere. -rfr */
131
132 #if !((defined (HAVE_LIBMAIL) || defined (HAVE_LIBLOCKFILE)) && \
133 defined (HAVE_MAILLOCK_H))
134 #define MAIL_USE_FLOCK
135 #endif
136
137 /* Define CLASH_DETECTION if you want lock files to be written
138 so that Emacs can tell instantly when you try to modify
139 a file that someone else has modified in his Emacs. */
140
141 #define CLASH_DETECTION
142
143 /* Here, on a separate page, add any special hacks needed
144 to make Emacs work on this system. For example,
145 you might define certain system call names that don't
146 exist on your system, or that do different things on
147 your system and must be used only through an encapsulation
148 (Which you should place, by convention, in sysdep.c). */
149 \f
150 /* This is needed for dispnew.c:update_frame */
151
152 #ifdef emacs
153 #include <stdio.h> /* Get the definition of _IO_STDIO_H. */
154 #if defined(_IO_STDIO_H) || defined(_STDIO_USES_IOSTREAM)
155 /* new C libio names */
156 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
157 ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
158 #elif defined (__UCLIBC__)
159 /* using the uClibc library */
160 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
161 ((FILE)->__bufpos - (FILE)->__bufstart)
162 #else /* !_IO_STDIO_H && ! __UCLIBC__ */
163 /* old C++ iostream names */
164 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
165 ((FILE)->_pptr - (FILE)->_pbase)
166 #endif /* !_IO_STDIO_H && ! __UCLIBC__ */
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 #define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o
173
174 /* Here is how to find X Windows. LD_SWITCH_X_SITE_AUX gives an -R option
175 that says where to find X windows at run time. */
176
177 #ifdef __mips__
178 #define LD_SWITCH_SYSTEM -G 0 $(LD_SWITCH_X_SITE_AUX)
179 #else
180 #define LD_SWITCH_SYSTEM $(LD_SWITCH_X_SITE_AUX)
181 #endif /* __mips__ */
182
183 #ifdef emacs
184 #define INTERRUPT_INPUT
185 #endif
186
187 #define SYSV_SYSTEM_DIR /* use dirent.h */
188
189 #define POSIX /* affects getpagesize.h and systty.h */
190 #define POSIX_SIGNALS
191
192 #undef LIB_GCC
193 #define LIB_GCC
194 #define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o
195
196 #ifdef HAVE_LIBNCURSES
197 #define TERMINFO
198 #define LIBS_TERMCAP -lncurses
199 #endif
200
201 #define UNEXEC unexelf.o
202
203 /* This is to work around mysterious gcc failures in some system versions.
204 It is unlikely that Emacs changes will work around this problem;
205 therefore, this should remain permanently. */
206 #ifndef HAVE_XRMSETDATABASE
207 #define HAVE_XRMSETDATABASE
208 #endif
209
210 /* Use BSD process groups, but use setpgid() instead of setpgrp() to
211 actually set a process group. */
212 /* Interesting: only GNU/Linux defines this, but the BSDs do not... */
213 /* #define BSD_PGRPS */
214
215 #define NARROWPROTO 1
216
217 /* Use mmap directly for allocating larger buffers. */
218 #ifdef DOUG_LEA_MALLOC
219 #undef REL_ALLOC
220 #endif
221
222 /* Tell that garbage collector that setjmp is known to save all
223 registers relevant for conservative garbage collection in the
224 jmp_buf. */
225 /* Not all the architectures are tested, but there are Debian packages
226 for SCM and/or Guile on them, so the technique must work. See also
227 comments in alloc.c concerning setjmp and gcc. Fixme: it's
228 probably safe to make this conditional just on GCC, except for ia64
229 register window-flushing. */
230 /* Don't use #cpu here since in newest development versions of GCC,
231 we must call cpp with -traditional, and that disables #cpu. */
232
233 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
234 || defined __alpha__ || defined __mips__ || defined __s390__ \
235 || defined __arm__ || defined __powerpc__ || defined __amd64__ \
236 || defined __ia64__ || defined __sh__
237 #define GC_SETJMP_WORKS 1
238 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
239 #ifdef __mc68000__
240 #define GC_LISP_OBJECT_ALIGNMENT 2
241 #endif
242 #ifdef __ia64__
243 #define GC_MARK_SECONDARY_STACK() \
244 do { \
245 extern void *__libc_ia64_register_backing_store_base; \
246 __builtin_ia64_flushrs (); \
247 mark_memory (__libc_ia64_register_backing_store_base, \
248 __builtin_ia64_bsp (), 0); \
249 } while (0)
250 #endif
251 #endif
252
253 /* arch-tag: 6244ea2a-abd0-44ec-abec-ff3dcc9afea9
254 (do not change this comment) */