OSDN Git Service

beams are not walls
[jnethack/source.git] / include / unixconf.h
1 /* NetHack 3.6  unixconf.h      $NHDT-Date: 1520099325 2018/03/03 17:48:45 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Pasi Kallinen, 2018. */
4 /* NetHack may be freely redistributed.  See license for details. */
5
6 #ifdef UNIX
7 #ifndef UNIXCONF_H
8 #define UNIXCONF_H
9
10 /*
11  * Some include files are in a different place under SYSV
12  *      BSD                SYSV
13  * <sys/time.h>         <time.h>
14  * <sgtty.h>            <termio.h>
15  *
16  * Some routines are called differently
17  * index                strchr
18  * rindex               strrchr
19  *
20  */
21
22 /* define exactly one of the following four choices */
23 /* #define BSD 1 */  /* define for 4.n/Free/Open/Net BSD  */
24                      /* also for relatives like SunOS 4.x, DG/UX, and */
25                      /* older versions of Linux */
26 /* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */
27                      /* Use BSD for < v3.0 */
28                      /* "ULTRIX" not to be confused with "ultrix" */
29 #define SYSV         /* define for System V, Solaris 2.x, newer versions */
30                      /* of Linux */
31 /* #define HPUX */   /* Hewlett-Packard's Unix, version 6.5 or higher */
32                      /* use SYSV for < v6.5 */
33
34 /* define any of the following that are appropriate */
35 #define SVR4           /* use in addition to SYSV for System V Release 4 */
36                        /* including Solaris 2+ */
37 #define NETWORK        /* if running on a networked system */
38                        /* e.g. Suns sharing a playground through NFS */
39 /* #define SUNOS4 */   /* SunOS 4.x */
40 #ifdef __linux__
41 #define LINUX    /* Another Unix clone */
42 #endif
43 /* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */
44 /* #define GENIX */    /* Yet Another Unix Clone */
45 /* #define HISX */     /* Bull Unix for XPS Machines */
46 /* #define BOS */      /* Bull Open Software - Unix for DPX/2 Machines */
47 /* #define UNIXPC */   /* use in addition to SYSV for AT&T 7300/3B1 */
48 /* #define AIX_31 */   /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
49                         * job control (note that AIX is SYSV otherwise)
50                         * Also define this for AIX 3.2 */
51
52 #define TERMINFO       /* uses terminfo rather than termcap */
53                        /* Should be defined for most SYSV, SVR4 (including
54                         * Solaris 2+), HPUX, and Linux systems.  In
55                         * particular, it should NOT be defined for the UNIXPC
56                         * unless you remove the use of the shared library in
57                         * the Makefile */
58 #define TEXTCOLOR      /* Use System V r3.2 terminfo color support
59                         * and/or ANSI color support on termcap systems
60                         * and/or X11 color */
61 #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control
62                            * (e.g., VSUSP) */
63 #define POSIX_TYPES /* use POSIX types for system calls and termios */
64                     /* Define for many recent OS releases, including
65                      * those with specific defines (since types are
66                      * changing toward the standard from earlier chaos).
67                      * For example, platforms using the GNU libraries,
68                      * Linux, Solaris 2.x
69                      */
70 #define POSIX_ICONV /* use POSIX iconv functions */
71
72 /* #define OPENWINBUG */  /* avoid a problem using OpenWindows 3.0 for
73                              X11 on SunOS 4.1.x, x>= 2.  Do not define
74                              for other X11 implementations. */
75 /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
76 /* #define BSD_43_BUG */  /* for real 4.3BSD cc's without schain botch fix */
77 /* #define MICROPORT_BUG */     /* problems with large arrays in structs */
78 /* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
79                                    run with Microport Sys V/AT version 2.4.
80                                    By Jay Maynard */
81 /* #define AIXPS_2BUG */ /* avoid a problem with little_to_big() optimization
82                             */
83
84 /* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48
85                         is available from your system */
86
87 /* see sys/unix/snd86unx.shr for more information on these */
88 /* #define UNIX386MUSIC */ /* play real music through speaker on systems
89                               with music driver installed */
90 /* #define VPIX_MUSIC */   /* play real music through speaker on systems
91                               with built-in VPIX support */
92
93 /*
94  * The next two defines are intended mainly for the Andrew File System,
95  * which does not allow hard links.  If NO_FILE_LINKS is defined, lock files
96  * will be created in LOCKDIR using open() instead of in the playground using
97  * link().
98  *              Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88)
99  */
100
101 /* #define NO_FILE_LINKS */                       /* if no hard links */
102 /* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */
103
104 /*
105  * If you want the static parts of your playground on a read-only file
106  * system, define VAR_PLAYGROUND to be where the variable parts are kept.
107  */
108 /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */
109
110 /*
111  * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
112  * If defined, it can be overridden by the environment variable PAGER.
113  * Hack will use its internal pager if DEF_PAGER is not defined.
114  * (This might be preferable for security reasons.)
115  */
116 /* #define DEF_PAGER ".../mydir/mypager" */
117
118 /*
119  * Define PORT_HELP to be the name of the port-specfic help file.
120  * This file is found in HACKDIR.
121  * Normally, you shouldn't need to change this.
122  * There is currently no port-specific help for Unix systems.
123  */
124 /* #define PORT_HELP "Unixhelp" */
125
126 #ifdef TTY_GRAPHICS
127 /*
128  * To enable the `timed_delay' option for using a timer rather than extra
129  * screen output when pausing for display effect.  Requires that `msleep'
130  * function be available (with time argument specified in milliseconds).
131  * Various output devices can produce wildly varying delays when the
132  * "extra output" method is used, but not all systems provide access to
133  * a fine-grained timer.
134  */
135 /* #define TIMED_DELAY */ /* usleep() */
136 #endif
137 #if defined(MACOSX) && !defined(TIMED_DELAY)
138 #define TIMED_DELAY
139 #endif
140
141 /* #define AVOID_WIN_IOCTL */ /* ensure USE_WIN_IOCTL remains undefined */
142
143 /*
144  * If you define MAIL, then the player will be notified of new mail
145  * when it arrives.  If you also define DEF_MAILREADER then this will
146  * be the default mail reader, and can be overridden by the environment
147  * variable MAILREADER; otherwise an internal pager will be used.
148  * A stat system call is done on the mailbox every MAILCKFREQ moves.
149  */
150 #if !defined(NOMAIL)
151 #define MAIL /* Deliver mail during the game */
152 #endif
153
154 /* The Andrew Message System does mail a little differently from normal
155  * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
156  * (another directory).  MAILBOX is the element that will be added on to
157  * the user's home directory path to generate the Mailbox path - just in
158  * case other Andrew sites do it differently from CMU.
159  *              dan lovinger
160  *              dl2n+@andrew.cmu.edu (dec 19 1989)
161  */
162
163 /* #define AMS */ /* use Andrew message system for mail */
164
165 /* NO_MAILREADER is for kerberos authenticating filesystems where it is
166  * essentially impossible to securely exec child processes, like mail
167  * readers, when the game is running under a special token.
168  *              dan
169  */
170
171 /* #define NO_MAILREADER */ /* have mail daemon just tell player of mail */
172
173 #ifdef MAIL
174 #if defined(BSD) || defined(ULTRIX)
175 #ifdef AMS
176 #define AMS_MAILBOX "/Mailbox"
177 #else
178 #if defined(__FreeBSD__) || defined(__OpenBSD__)
179 #define DEF_MAILREADER "/usr/bin/mail"
180 #else
181 #define DEF_MAILREADER "/usr/ucb/Mail"
182 #endif
183 #endif
184 #else
185 #if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
186 #if defined(M_XENIX)
187 #define DEF_MAILREADER "/usr/bin/mail"
188 #else
189 #ifdef __sgi
190 #define DEF_MAILREADER "/usr/sbin/Mail"
191 #else
192 #define DEF_MAILREADER "/usr/bin/mailx"
193 #endif
194 #endif
195 #else
196 #define DEF_MAILREADER "/bin/mail"
197 #endif
198 #endif
199
200 /* If SIMPLE_MAIL is defined, the mail spool file format is
201    "sender:message", one mail per line, and mails are
202    read within game, from demon-delivered mail scrolls.
203    The mail spool file will be deleted once the player
204    has read the message. */
205 /* #define SIMPLE_MAIL */
206
207 #ifndef MAILCKFREQ
208 /* How often mail spool file is checked for new messages, in turns */
209 #define MAILCKFREQ 50
210 #endif
211
212 #endif /* MAIL */
213
214 /* If SERVER_ADMIN_MSG is defined and the file exists, players get
215    a message from the user defined in the file.  The file format
216    is "sender:message" all in one line. */
217 /* #define SERVER_ADMIN_MSG "adminmsg" */
218 #ifndef SERVER_ADMIN_MSG_CKFREQ
219 /* How often admin message file is checked for new messages, in turns */
220 #define SERVER_ADMIN_MSG_CKFREQ 25
221 #endif
222
223
224 /*
225  * Some terminals or terminal emulators send two character sequence "ESC c"
226  * when Alt+c is pressed.  The altmeta run-time option allows the user to
227  * request that "ESC c" be treated as M-c.
228  */
229 #define ALTMETA /* support altmeta run-time option */
230
231 #ifdef COMPRESS
232 /* Some implementations of compress need a 'quiet' option.
233  * If you've got one of these versions, put -q here.
234  * You can also include any other strange options your compress needs.
235  * If you have a normal compress, just leave it commented out.
236  */
237 /* #define COMPRESS_OPTIONS "-q" */
238 #endif
239
240 #ifndef FCMASK
241 #define FCMASK 0660 /* file creation mask */
242 #endif
243
244 /* fcntl(2) is a POSIX-portable call for manipulating file descriptors.
245  * Comment out the USE_FCNTL if for some reason you have a strange
246  * OS/filesystem combination for which fcntl(2) does not work. */
247 #ifdef POSIX_TYPES
248 #define USE_FCNTL
249 #endif
250
251 /*
252  * The remainder of the file should not need to be changed.
253  */
254
255 #ifdef _AUX_SOURCE
256 #ifdef AUX /* gcc ? */
257 #define _SYSV_SOURCE
258 #define _BSD_SOURCE
259 #else
260 #define AUX
261 #endif
262 #endif /* _AUX_SOURCE */
263
264 #if defined(LINUX) || defined(bsdi)
265 #ifndef POSIX_TYPES
266 #define POSIX_TYPES
267 #endif
268 #ifndef POSIX_JOB_CONTROL
269 #define POSIX_JOB_CONTROL
270 #endif
271 #endif
272
273 /*
274  * BSD/ULTRIX systems are normally the only ones that can suspend processes.
275  * Suspending NetHack processes cleanly should be easy to add to other systems
276  * that have SIGTSTP in the Berkeley sense.  Currently the only such systems
277  * known to work are HPUX and AIX 3.1; other systems will probably require
278  * tweaks to unixtty.c and ioctl.c.
279  *
280  * POSIX defines a slightly different type of job control, which should be
281  * equivalent for NetHack's purposes.  POSIX_JOB_CONTROL should work on
282  * various recent SYSV versions (with possibly tweaks to unixtty.c again).
283  */
284 #ifndef POSIX_JOB_CONTROL
285 #if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31)
286 #define BSD_JOB_CONTROL
287 #else
288 #if defined(SVR4)
289 #define POSIX_JOB_CONTROL
290 #endif
291 #endif
292 #endif
293 #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX)
294 #define SUSPEND /* let ^Z suspend the game */
295 #endif
296
297 /*
298  * Define SAFERHANGUP to delay hangup processing until the main command
299  * loop. 'safer' because it avoids certain cheats and also avoids losing
300  * objects being thrown when the hangup occurs.  All unix windowports
301  * support SAFERHANGUP (couldn't define it here otherwise).
302  */
303 #define SAFERHANGUP
304
305 #if defined(BSD) || defined(ULTRIX)
306 #include <sys/time.h>
307 #else
308 #include <time.h>
309 #endif
310
311 #define HLOCK "perm" /* an empty file used for locking purposes */
312
313 #define tgetch getchar
314
315 #ifndef NOSHELL
316 #define SHELL /* do not delete the '!' command */
317 #endif
318
319 #include "system.h"
320
321 #if defined(POSIX_TYPES) || defined(__GNUC__)
322 #include <stdlib.h>
323 #include <unistd.h>
324 #endif
325
326 #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) \
327     || defined(ULTRIX)
328 #include <sys/wait.h>
329 #endif
330
331 #if defined(BSD) || defined(ULTRIX)
332 #if !defined(DGUX) && !defined(SUNOS4)
333 #define memcpy(d, s, n) bcopy(s, d, n)
334 #define memcmp(s1, s2, n) bcmp(s2, s1, n)
335 #endif
336 #ifdef SUNOS4
337 #include <memory.h>
338 #endif
339 #else         /* therefore SYSV */
340 #ifndef index /* some systems seem to do this for you */
341 #define index strchr
342 #endif
343 #ifndef rindex
344 #define rindex strrchr
345 #endif
346 #endif
347
348 /* Use the high quality random number routines. */
349 #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \
350     || defined(RANDOM) || defined(__APPLE__)
351 #define Rand() random()
352 #else
353 #define Rand() lrand48()
354 #endif
355
356 #ifdef TIMED_DELAY
357 #if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
358 #define msleep(k) usleep((k) *1000)
359 #endif
360 #ifdef ULTRIX
361 #define msleep(k) napms(k)
362 #endif
363 #endif
364
365 #ifdef hc /* older versions of the MetaWare High-C compiler define this */
366 #ifdef __HC__
367 #undef __HC__
368 #endif
369 #define __HC__ hc
370 #undef hc
371 #endif
372
373 #if defined(GNOME_GRAPHICS)
374 #if defined(LINUX)
375 #include <linux/unistd.h>
376 #if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */
377 #define GETRES_SUPPORT
378 #endif
379 #else
380 #if defined(BSD) || defined(SVR4)
381 /*
382  * [ALI] We assume that SVR4 means we can safely include syscall.h
383  * (although it's really a BSDism). This is certainly true for Solaris 2.5,
384  * Solaris 7, Solaris 8 and Compaq Tru64 5.1
385  * Later BSD systems will have the getresid system calls.
386  */
387 #include <sys/syscall.h>
388 #if (defined(SYS_getuid) || defined(SYS_getresuid)) \
389     && (defined(SYS_getgid) || defined(SYS_getresgid))
390 #define GETRES_SUPPORT
391 #endif
392 #endif /* BSD || SVR4 */
393 #endif /* LINUX */
394 #endif /* GNOME_GRAPHICS */
395
396 #ifdef __APPLE__
397 # define RUNTIME_PASTEBUF_SUPPORT
398 #endif
399
400 #endif /* UNIXCONF_H */
401 #endif /* UNIX */