Revert bogus revision 2001-02-20T10:59:03Z!fx@gnu.org.
[bpt/emacs.git] / src / s / freebsd.h
CommitLineData
be210740
KH
1/* s/ file for freebsd system. */
2
62bb752f
RS
3/* Get the correct __FreeBSD_version, even if this is before that was
4 defined. */
7e6c20e8 5#ifndef __FreeBSD_version
62bb752f
RS
6#ifndef __FreeBSD__
7#define __FreeBSD_version 199401
8#elif __FreeBSD__ == 1
9#define __FreeBSD_version 199405
10#else
11#include <osreldate.h>
12#endif
7e6c20e8 13#endif /* !defined __FreeBSD_version */
62bb752f 14
3051bc72 15/* '__FreeBSD__' is defined by the preprocessor on FreeBSD-1.1 and up.
d05c42e4
RS
16 Earlier versions do not have shared libraries, so inhibit them.
17 You can inhibit them on newer systems if you wish
18 by defining NO_SHARED_LIBS. */
3051bc72
RS
19#ifndef __FreeBSD__
20#define NO_SHARED_LIBS
21#endif
be210740 22
c0096c73
RS
23
24#if 0 /* This much, alone, seemed sufficient as of 19.23.
25 But it seems better to be independent of netbsd.h. */
3051bc72 26#include "netbsd.h"
be210740 27
3051bc72
RS
28#undef LIB_GCC
29#define LIB_GCC -lgcc
30#undef NEED_ERRNO
c0096c73
RS
31#endif /* 0 */
32
33
34/* Get most of the stuff from bsd4.3 */
35#include "bsd4-3.h"
36
37/* For mem-limits.h. */
38#define BSD4_2
39
e57d8da0 40/* These aren't needed, since we have getloadavg. */
c0096c73
RS
41#undef KERNEL_FILE
42#undef LDAV_SYMBOL
43
44#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
45
c0096c73
RS
46#define LIBS_DEBUG
47#define LIBS_SYSTEM -lutil
7e0ba6da 48#if __FreeBSD_version < 400000
c0096c73 49#define LIBS_TERMCAP -ltermcap
7e0ba6da 50#endif
c0096c73 51
c0096c73
RS
52#define SYSV_SYSTEM_DIR
53
54/* freebsd has POSIX-style pgrp behavior. */
55#undef BSD_PGRPS
9f9d7a9a 56#define GETPGRP_NO_ARG
c0096c73 57
62bb752f
RS
58#ifdef __ELF__
59
1f71352b 60#define LD_SWITCH_SYSTEM_1
62bb752f
RS
61#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
62#define UNEXEC unexelf.o
63#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
64#undef LIB_GCC
65#define LIB_GCC
66
67#else /* not __ELF__ */
68
c0096c73 69#ifndef NO_SHARED_LIBS
1f71352b 70#define LD_SWITCH_SYSTEM_1 -e start -dc -L/usr/local/lib
c0096c73 71#define HAVE_TEXT_START /* No need to define `start_of_text'. */
62bb752f
RS
72#if __FreeBSD_version >= 300002
73#define START_FILES pre-crt0.o /usr/lib/aout/crt0.o
74#else /* __FreeBSD_version < 300002 */
c0096c73 75#define START_FILES pre-crt0.o /usr/lib/crt0.o
62bb752f 76#endif /* __FreeBSD_version < 300002 */
c0096c73
RS
77#define UNEXEC unexsunos4.o
78#define RUN_TIME_REMAP
62bb752f 79#define LIB_GCC -lgcc
c0096c73
RS
80
81#ifndef N_TRELOFF
82#define N_PAGSIZ(x) __LDPGSZ
83#define N_BSSADDR(x) (N_ALIGN(x, N_DATADDR(x)+x.a_data))
84#define N_TRELOFF(x) N_RELOFF(x)
85#endif
d05c42e4
RS
86#else /* NO_SHARED_LIBS */
87#ifdef __FreeBSD__ /* shared libs are available, but the user prefers
88 not to use them. */
1f71352b 89#define LD_SWITCH_SYSTEM_1 -Bstatic -L/usr/local/lib
d05c42e4
RS
90#define A_TEXT_OFFSET(x) (sizeof (struct exec))
91#define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr))
92#endif /* __FreeBSD__ */
93#endif /* NO_SHARED_LIBS */
c0096c73 94
62bb752f
RS
95#endif /* not __ELF__ */
96
1f71352b
GM
97/* Let `ld' find image libs and similar things in /usr/local/lib. The
98 system compiler, GCC, has apparently been modified to not look
99 there, contrary to what a stock GCC would do. */
100
101#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_1 -L/usr/local/lib
102
c0096c73 103#define HAVE_WAIT_HEADER
8fffa182 104#define HAVE_GETLOADAVG 1
2327e4a0
GM
105#if 0
106#define HAVE_GETPAGESIZE /* configure now puts this in config.h */
107#endif
c0096c73
RS
108#define HAVE_TERMIOS
109#define NO_TERMIO
d05c42e4 110#define DECLARE_GETPWUID_WITH_UID_T
c0096c73
RS
111
112/* freebsd uses OXTABS instead of the expected TAB3. */
113#define TABDLY OXTABS
114#define TAB3 OXTABS
115
116/* this silences a few compilation warnings */
6df54671 117#undef BSD_SYSTEM
69d87222 118#if __FreeBSD__ == 1
6df54671 119#define BSD_SYSTEM 199103
69d87222 120#elif __FreeBSD__ == 2
6df54671 121#define BSD_SYSTEM 199306
165e2d55 122#elif __FreeBSD__ >= 3
3e7562b1 123#define BSD_SYSTEM 199506
69d87222 124#endif
c0096c73 125
026d2a71
GM
126#if 0 /* Shouldn't be necessary and produces warnings with the
127 experimental Autoconf test. */
c0096c73
RS
128#define WAITTYPE int
129/* get this since it won't be included if WAITTYPE is defined */
130#ifdef emacs
131#include <sys/wait.h>
132#endif
133#define WRETCODE(w) (_W_INT(w) >> 8)
026d2a71 134#endif
22fcc83e
RS
135
136/* Needed to avoid hanging when child process writes an error message
137 and exits -- enami tsugutomo <enami@ba2.so-net.or.jp>. */
138#define vfork fork
b68f1a63
RS
139
140/* Don't close pty in process.c to make it as controlling terminal.
141 It is already a controlling terminal of subprocess, because we did
142 ioctl TIOCSCTTY. */
143#define DONT_REOPEN_PTY
145eec6f
RS
144
145/* CLASH_DETECTION is defined in bsd4-3.h.
146 In FreeBSD 2.1.5 (and other 2.1.x), this results useless symbolic links
147 remaining in /tmp or other directories with +t bit.
148 To avoid this problem, you could #undef it to use no file lock. */
149/* #undef CLASH_DETECTION */
2327e4a0
GM
150
151/* If the system's imake configuration file defines `NeedWidePrototypes'
152 as `NO', we must define NARROWPROTO manually. Such a define is
153 generated in the Makefile generated by `xmkmf'. If we don't
154 define NARROWPROTO, we will see the wrong function prototypes
155 for X functions taking float or double parameters. */
156
157#define NARROWPROTO 1
ab5d1ddf 158
ef539202
GM
159/* The following is needed to make `configure' find Xpm, Xaw3d and
160 image include and library files if using /usr/bin/gcc. That
161 compiler seems to be modified to not find headers in
162 /usr/local/include or libs in /usr/local/lib by default. */
ab5d1ddf 163
1f71352b 164#define C_SWITCH_SYSTEM -I/usr/X11R6/include -I/usr/local/include -L/usr/local/lib
aace035e
GM
165
166/* Circumvent a bug in FreeBSD. In the following sequence of
167 writes/reads on a PTY, read(2) returns bogus data:
168
169 write(2) 1022 bytes
170 write(2) 954 bytes, get EAGAIN
171 read(2) 1024 bytes in process_read_output
172 read(2) 11 bytes in process_read_output
173
174 That is, read(2) returns more bytes than have ever been written
175 successfully. The 1033 bytes read are the 1022 bytes written
176 successfully after processing (for example with CRs added if the
177 terminal is set up that way which it is here). The same bytes will
178 be seen again in a later read(2), without the CRs. */
179
180#define BROKEN_PTY_READ_AFTER_EAGAIN 1
4b3fd719
GM
181
182/* Tell that garbage collector that setjmp is known to save all
183 registers relevant for conservative garbage collection in the
184 jmp_buf. */
185
186#define GC_SETJMP_WORKS 1
cbf5ca04 187
fc653ef2
GM
188/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the
189 stack. */
190
fc40e215 191#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
fc653ef2 192
67cdbf16
GM
193/* Define USE_MMAP_FOR_BUFFERS to let Emacs use mmap(2) to allocate
194 buffer text. This overrides REL_ALLOC. */
fc653ef2 195
67cdbf16 196#define USE_MMAP_FOR_BUFFERS 1
76bb714a
GM
197
198/* Use sigprocmask(2) and friends instead of sigblock(2); the man page
199 of sigblock says it is obsolete. */
200
201#define POSIX_SIGNALS 1