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