Add 2007 to copyright years.
[bpt/emacs.git] / 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 Free Software Foundation, Inc.
6
7 This file is part of GNU Emacs.
8
9 GNU Emacs is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 GNU Emacs is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU Emacs; see the file COPYING. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. */
23
24 /* Get the correct __FreeBSD_version, even if this is before that was
25 defined. */
26 #ifndef __FreeBSD_version
27 #ifndef __FreeBSD__
28 #define __FreeBSD_version 199401
29 #elif __FreeBSD__ == 1
30 #define __FreeBSD_version 199405
31 #else
32 #include <osreldate.h>
33 #endif
34 #endif /* !defined __FreeBSD_version */
35
36 /* '__FreeBSD__' is defined by the preprocessor on FreeBSD-1.1 and up.
37 Earlier versions do not have shared libraries, so inhibit them.
38 You can inhibit them on newer systems if you wish
39 by defining NO_SHARED_LIBS. */
40 #ifndef __FreeBSD__
41 #define NO_SHARED_LIBS
42 #endif
43
44
45 #if 0 /* This much, alone, seemed sufficient as of 19.23.
46 But it seems better to be independent of netbsd.h. */
47 #include "netbsd.h"
48
49 #undef LIB_GCC
50 #define LIB_GCC -lgcc
51 #undef NEED_ERRNO
52 #endif /* 0 */
53
54
55 /* Get most of the stuff from bsd4.3 */
56 #include "bsd4-3.h"
57
58 /* For mem-limits.h. */
59 #define BSD4_2
60
61 /* These aren't needed, since we have getloadavg. */
62 #undef KERNEL_FILE
63 #undef LDAV_SYMBOL
64
65 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
66
67 #define LIBS_DEBUG
68 #define LIBS_SYSTEM -lutil
69 #if __FreeBSD_version < 400000
70 #define LIBS_TERMCAP -ltermcap
71 #else
72 #define TERMINFO
73 #define LIBS_TERMCAP -lncurses
74 #endif
75
76 #define SYSV_SYSTEM_DIR
77
78 /* freebsd has POSIX-style pgrp behavior. */
79 #undef BSD_PGRPS
80 #define GETPGRP_NO_ARG
81
82 #ifdef __ELF__
83
84 #define LD_SWITCH_SYSTEM_1
85 #define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
86 #define UNEXEC unexelf.o
87 #define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
88 #undef LIB_GCC
89 #define LIB_GCC
90
91 #else /* not __ELF__ */
92
93 #ifndef NO_SHARED_LIBS
94 #define LD_SWITCH_SYSTEM_1 -e start -dc -L/usr/local/lib
95 #define HAVE_TEXT_START /* No need to define `start_of_text'. */
96 #if __FreeBSD_version >= 300002
97 #define START_FILES pre-crt0.o /usr/lib/aout/crt0.o
98 #else /* __FreeBSD_version < 300002 */
99 #define START_FILES pre-crt0.o /usr/lib/crt0.o
100 #endif /* __FreeBSD_version < 300002 */
101 #define UNEXEC unexsunos4.o
102 #define RUN_TIME_REMAP
103 #define LIB_GCC -lgcc
104
105 #ifndef N_TRELOFF
106 #define N_PAGSIZ(x) __LDPGSZ
107 #define N_BSSADDR(x) (N_ALIGN(x, N_DATADDR(x)+x.a_data))
108 #define N_TRELOFF(x) N_RELOFF(x)
109 #endif
110 #else /* NO_SHARED_LIBS */
111 #ifdef __FreeBSD__ /* shared libs are available, but the user prefers
112 not to use them. */
113 #define LD_SWITCH_SYSTEM_1 -Bstatic -L/usr/local/lib
114 #define A_TEXT_OFFSET(x) (sizeof (struct exec))
115 #define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr))
116 #endif /* __FreeBSD__ */
117 #endif /* NO_SHARED_LIBS */
118
119 #endif /* not __ELF__ */
120
121 /* Let `ld' find image libs and similar things in /usr/local/lib. The
122 system compiler, GCC, has apparently been modified to not look
123 there, contrary to what a stock GCC would do. */
124
125 #define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_1 -L/usr/local/lib
126
127 #define HAVE_WAIT_HEADER
128 #define HAVE_GETLOADAVG 1
129 #if 0
130 #define HAVE_GETPAGESIZE /* configure now puts this in config.h */
131 #endif
132 #define HAVE_TERMIOS
133 #define NO_TERMIO
134 #define DECLARE_GETPWUID_WITH_UID_T
135
136 /* freebsd uses OXTABS instead of the expected TAB3. */
137 #define TABDLY OXTABS
138 #define TAB3 OXTABS
139
140 /* this silences a few compilation warnings */
141 #undef BSD_SYSTEM
142 #if __FreeBSD__ == 1
143 #define BSD_SYSTEM 199103
144 #elif __FreeBSD__ == 2
145 #define BSD_SYSTEM 199306
146 #elif __FreeBSD__ >= 3
147 #define BSD_SYSTEM 199506
148 #endif
149
150 #if 0 /* Shouldn't be necessary and produces warnings with the
151 experimental Autoconf test. */
152 #define WAITTYPE int
153 /* get this since it won't be included if WAITTYPE is defined */
154 #ifdef emacs
155 #include <sys/wait.h>
156 #endif
157 #define WRETCODE(w) (_W_INT(w) >> 8)
158 #endif
159
160 /* Don't close pty in process.c to make it as controlling terminal.
161 It is already a controlling terminal of subprocess, because we did
162 ioctl TIOCSCTTY. */
163 #define DONT_REOPEN_PTY
164
165 /* CLASH_DETECTION is defined in bsd4-3.h.
166 In FreeBSD 2.1.5 (and other 2.1.x), this results useless symbolic links
167 remaining in /tmp or other directories with +t bit.
168 To avoid this problem, you could #undef it to use no file lock. */
169 /* #undef CLASH_DETECTION */
170
171 /* If the system's imake configuration file defines `NeedWidePrototypes'
172 as `NO', we must define NARROWPROTO manually. Such a define is
173 generated in the Makefile generated by `xmkmf'. If we don't
174 define NARROWPROTO, we will see the wrong function prototypes
175 for X functions taking float or double parameters. */
176
177 #define NARROWPROTO 1
178
179 /* The following is needed to make `configure' find Xpm, Xaw3d and
180 image include and library files if using /usr/bin/gcc. That
181 compiler seems to be modified to not find headers in
182 /usr/local/include or libs in /usr/local/lib by default. */
183
184 #define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/local/include -L/usr/local/lib
185
186 /* Circumvent a bug in FreeBSD. In the following sequence of
187 writes/reads on a PTY, read(2) returns bogus data:
188
189 write(2) 1022 bytes
190 write(2) 954 bytes, get EAGAIN
191 read(2) 1024 bytes in process_read_output
192 read(2) 11 bytes in process_read_output
193
194 That is, read(2) returns more bytes than have ever been written
195 successfully. The 1033 bytes read are the 1022 bytes written
196 successfully after processing (for example with CRs added if the
197 terminal is set up that way which it is here). The same bytes will
198 be seen again in a later read(2), without the CRs. */
199
200 #define BROKEN_PTY_READ_AFTER_EAGAIN 1
201
202 /* Tell that garbage collector that setjmp is known to save all
203 registers relevant for conservative garbage collection in the
204 jmp_buf. */
205
206 #define GC_SETJMP_WORKS 1
207
208 /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the
209 stack. */
210
211 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
212
213 /* Define USE_MMAP_FOR_BUFFERS to let Emacs use mmap(2) to allocate
214 buffer text. This overrides REL_ALLOC. */
215
216 #define USE_MMAP_FOR_BUFFERS 1
217
218 /* Use sigprocmask(2) and friends instead of sigblock(2); the man page
219 of sigblock says it is obsolete. */
220
221 #define POSIX_SIGNALS 1
222
223 /* The `combreloc' setting became the default, and it seems to be
224 incompatible with unexec. Symptom is an immediate SEGV in
225 XtInitializeWidget when starting Emacs under X11. */
226
227 #if defined __FreeBSD_version && __FreeBSD_version >= 500042
228 #define LD_SWITCH_SYSTEM_TEMACS -znocombreloc
229 #endif
230
231 /* arch-tag: 426529ca-b7c4-448f-b10a-d4dcdc9c78eb
232 (do not change this comment) */