]> code.delx.au - gnu-emacs/blob - src/s/freebsd.h
acb9ec95db25a4dc4451017097615b44e1e2f418
[gnu-emacs] / src / s / freebsd.h
1 /* System description header for FreeBSD systems.
2 This file describes the parameters that system description files
3 should define or not.
4 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5 2003, 2004, 2005, 2006, 2007, 2008
6 Free Software Foundation, Inc.
7
8 This file is part of GNU Emacs.
9
10 GNU Emacs is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 GNU Emacs is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22
23 /* Get the correct __FreeBSD_version, even if this is before that was
24 defined. */
25 #ifndef __FreeBSD_version
26 #ifndef __FreeBSD__
27 #define __FreeBSD_version 199401
28 #elif __FreeBSD__ == 1
29 #define __FreeBSD_version 199405
30 #else
31 #include <osreldate.h>
32 #endif
33 #endif /* !defined __FreeBSD_version */
34
35 /* '__FreeBSD__' is defined by the preprocessor on FreeBSD-1.1 and up.
36 Earlier versions do not have shared libraries, so inhibit them.
37 You can inhibit them on newer systems if you wish
38 by defining NO_SHARED_LIBS. */
39 #ifndef __FreeBSD__
40 #define NO_SHARED_LIBS
41 #endif
42
43 /* Get most of the stuff from bsd-common */
44 #include "bsd-common.h"
45
46 /* For mem-limits.h. */
47 #define BSD4_2
48
49 /* These aren't needed, since we have getloadavg. */
50 #undef KERNEL_FILE
51 #undef LDAV_SYMBOL
52
53 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
54
55 #define LIBS_DEBUG
56 #define LIBS_SYSTEM -lutil
57 #if __FreeBSD_version < 400000
58 #define LIBS_TERMCAP -ltermcap
59 #else
60 #define TERMINFO
61 #define LIBS_TERMCAP -lncurses
62 #endif
63
64 #define SYSV_SYSTEM_DIR
65
66 /* freebsd has POSIX-style pgrp behavior. */
67 #undef BSD_PGRPS
68
69 #ifdef __ELF__
70
71 /* Let `ld' find image libs and similar things in /usr/local/lib. The
72 system compiler, GCC, has apparently been modified to not look
73 there, contrary to what a stock GCC would do. */
74
75 #define LD_SWITCH_SYSTEM -L/usr/local/lib
76 #define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
77 #define UNEXEC unexelf.o
78 #define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
79 #undef LIB_GCC
80 #define LIB_GCC
81
82 #else /* not __ELF__ */
83
84 #ifndef NO_SHARED_LIBS
85 #define LD_SWITCH_SYSTEM -e start -dc -L/usr/local/lib
86 #define HAVE_TEXT_START /* No need to define `start_of_text'. */
87 #if __FreeBSD_version >= 300002
88 #define START_FILES pre-crt0.o /usr/lib/aout/crt0.o
89 #else /* __FreeBSD_version < 300002 */
90 #define START_FILES pre-crt0.o /usr/lib/crt0.o
91 #endif /* __FreeBSD_version < 300002 */
92 #define UNEXEC unexsunos4.o
93 #define RUN_TIME_REMAP
94 #define LIB_GCC -lgcc
95
96 #else /* NO_SHARED_LIBS */
97 #ifdef __FreeBSD__ /* shared libs are available, but the user prefers
98 not to use them. */
99 #define LD_SWITCH_SYSTEM -Bstatic -L/usr/local/lib
100 #endif /* __FreeBSD__ */
101 #endif /* NO_SHARED_LIBS */
102
103 #endif /* not __ELF__ */
104
105 #define HAVE_GETLOADAVG 1
106 #define HAVE_TERMIOS
107 #define NO_TERMIO
108 #define DECLARE_GETPWUID_WITH_UID_T
109
110 /* freebsd uses OXTABS instead of the expected TAB3. */
111 #define TABDLY OXTABS
112 #define TAB3 OXTABS
113
114 /* this silences a few compilation warnings */
115 #undef BSD_SYSTEM
116 #if __FreeBSD__ == 1
117 #define BSD_SYSTEM 199103
118 #elif __FreeBSD__ == 2
119 #define BSD_SYSTEM 199306
120 #elif __FreeBSD__ >= 3
121 #define BSD_SYSTEM 199506
122 #endif
123
124 /* Don't close pty in process.c to make it as controlling terminal.
125 It is already a controlling terminal of subprocess, because we did
126 ioctl TIOCSCTTY. */
127 #define DONT_REOPEN_PTY
128
129 /* If the system's imake configuration file defines `NeedWidePrototypes'
130 as `NO', we must define NARROWPROTO manually. Such a define is
131 generated in the Makefile generated by `xmkmf'. If we don't
132 define NARROWPROTO, we will see the wrong function prototypes
133 for X functions taking float or double parameters. */
134
135 #define NARROWPROTO 1
136
137 /* The following is needed to make `configure' find Xpm, Xaw3d and
138 image include and library files if using /usr/bin/gcc. That
139 compiler seems to be modified to not find headers in
140 /usr/local/include or libs in /usr/local/lib by default. */
141
142 #define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/local/include -L/usr/local/lib
143
144 /* Circumvent a bug in FreeBSD. In the following sequence of
145 writes/reads on a PTY, read(2) returns bogus data:
146
147 write(2) 1022 bytes
148 write(2) 954 bytes, get EAGAIN
149 read(2) 1024 bytes in process_read_output
150 read(2) 11 bytes in process_read_output
151
152 That is, read(2) returns more bytes than have ever been written
153 successfully. The 1033 bytes read are the 1022 bytes written
154 successfully after processing (for example with CRs added if the
155 terminal is set up that way which it is here). The same bytes will
156 be seen again in a later read(2), without the CRs. */
157
158 #define BROKEN_PTY_READ_AFTER_EAGAIN 1
159
160 /* Tell that garbage collector that setjmp is known to save all
161 registers relevant for conservative garbage collection in the
162 jmp_buf. */
163
164 #define GC_SETJMP_WORKS 1
165
166 /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the
167 stack. */
168
169 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
170
171 /* Define USE_MMAP_FOR_BUFFERS to let Emacs use mmap(2) to allocate
172 buffer text. This overrides REL_ALLOC. */
173
174 #define USE_MMAP_FOR_BUFFERS 1
175
176 /* Use sigprocmask(2) and friends instead of sigblock(2); the man page
177 of sigblock says it is obsolete. */
178
179 #define POSIX_SIGNALS 1
180
181 /* The `combreloc' setting became the default, and it seems to be
182 incompatible with unexec. Symptom is an immediate SEGV in
183 XtInitializeWidget when starting Emacs under X11. */
184
185 #if defined __FreeBSD_version && __FreeBSD_version >= 500042
186 #define LD_SWITCH_SYSTEM_TEMACS -znocombreloc
187 #endif
188
189 /* arch-tag: 426529ca-b7c4-448f-b10a-d4dcdc9c78eb
190 (do not change this comment) */