OSDN Git Service

shrink mine
[nethackexpress/trunk.git] / include / unixconf.h
1 /*      SCCS Id: @(#)unixconf.h 3.4     1999/07/02      */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 #ifdef UNIX
6 #ifndef UNIXCONF_H
7 #define UNIXCONF_H
8
9 /*
10  * Some include files are in a different place under SYSV
11  *      BSD                SYSV
12  * <sys/time.h>         <time.h>
13  * <sgtty.h>            <termio.h>
14  *
15  * Some routines are called differently
16  * index                strchr
17  * rindex               strrchr
18  *
19  */
20
21 /* define exactly one of the following four choices */
22 /* #define BSD 1 */     /* define for 4.n/Free/Open/Net BSD  */
23                         /* also for relatives like SunOS 4.x, DG/UX, and */
24                         /* older versions of Linux */
25 /* #define ULTRIX */    /* define for Ultrix v3.0 or higher (but not lower) */
26                         /* Use BSD for < v3.0 */
27                         /* "ULTRIX" not to be confused with "ultrix" */
28 #define SYSV            /* define for System V, Solaris 2.x, newer versions */
29                         /* of Linux */
30 /* #define HPUX */      /* Hewlett-Packard's Unix, version 6.5 or higher */
31                         /* use SYSV for < v6.5 */
32
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 /* #define LINUX */     /* Another Unix clone */
41 /* #define CYGWIN32 */  /* Unix on Win32 -- use with case sensitive defines */
42 /* #define GENIX */     /* Yet Another Unix Clone */
43 /* #define HISX */      /* Bull Unix for XPS Machines */
44 /* #define BOS */       /* Bull Open Software - Unix for DPX/2 Machines */
45 /* #define UNIXPC */    /* use in addition to SYSV for AT&T 7300/3B1 */
46 /* #define AIX_31 */    /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
47                          * job control (note that AIX is SYSV otherwise)
48                          * Also define this for AIX 3.2 */
49
50 #define TERMINFO        /* uses terminfo rather than termcap */
51                         /* Should be defined for most SYSV, SVR4 (including
52                          * Solaris 2+), HPUX, and Linux systems.  In
53                          * particular, it should NOT be defined for the UNIXPC
54                          * unless you remove the use of the shared library in
55                          * the Makefile */
56 #define TEXTCOLOR       /* Use System V r3.2 terminfo color support */
57                         /* and/or ANSI color support on termcap systems */
58                         /* and/or X11 color */
59 #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control */
60                         /* (e.g., VSUSP) */
61 #define POSIX_TYPES     /* use POSIX types for system calls and termios */
62                         /* Define for many recent OS releases, including
63                          * those with specific defines (since types are
64                          * changing toward the standard from earlier chaos).
65                          * For example, platforms using the GNU libraries,
66                          * Linux, Solaris 2.x
67                          */
68
69 /* #define OPENWINBUG */        /* avoid a problem using OpenWindows 3.0 for
70                                    X11 on SunOS 4.1.x, x>= 2.  Do not define
71                                    for other X11 implementations. */
72 /* #define PYRAMID_BUG */       /* avoid a bug on the Pyramid */
73 /* #define BSD_43_BUG */        /* for real 4.3BSD cc's without schain botch fix */
74 /* #define MICROPORT_BUG */     /* problems with large arrays in structs */
75 /* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
76                                    run with Microport Sys V/AT version 2.4.
77                                    By Jay Maynard */
78 /* #define AIXPS_2BUG */        /* avoid a problem with little_to_big() optimization */
79
80 /* #define RANDOM */            /* if neither random/srandom nor lrand48/srand48
81                                    is available from your system */
82
83 /* see sys/unix/snd86unx.shr for more information on these */
84 /* #define UNIX386MUSIC */      /* play real music through speaker on systems
85                                    with music driver installed */
86 /* #define VPIX_MUSIC */        /* play real music through speaker on systems
87                                    with built-in VPIX support */
88
89
90 /*
91  * The next two defines are intended mainly for the Andrew File System,
92  * which does not allow hard links.  If NO_FILE_LINKS is defined, lock files
93  * will be created in LOCKDIR using open() instead of in the playground using
94  * link().
95  *              Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88)
96  */
97
98 /* #define NO_FILE_LINKS */     /* if no hard links */
99 /* #define LOCKDIR "/usr/games/lib/nethackdir" */       /* where to put locks */
100
101 /*
102  * If you want the static parts of your playground on a read-only file
103  * system, define VAR_PLAYGROUND to be where the variable parts are kept.
104  */
105 /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */
106
107
108 /*
109  * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
110  * If defined, it can be overridden by the environment variable PAGER.
111  * Hack will use its internal pager if DEF_PAGER is not defined.
112  * (This might be preferable for security reasons.)
113  * #define DEF_PAGER    ".../mydir/mypager"
114  */
115
116
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
138 /*
139  * If you define MAIL, then the player will be notified of new mail
140  * when it arrives.  If you also define DEF_MAILREADER then this will
141  * be the default mail reader, and can be overridden by the environment
142  * variable MAILREADER; otherwise an internal pager will be used.
143  * A stat system call is done on the mailbox every MAILCKFREQ moves.
144  */
145
146 #define MAIL                    /* Deliver mail during the game */
147
148 /* The Andrew Message System does mail a little differently from normal
149  * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
150  * (another directory).  MAILBOX is the element that will be added on to
151  * the user's home directory path to generate the Mailbox path - just in
152  * case other Andrew sites do it differently from CMU.
153  *
154  *              dan lovinger
155  *              dl2n+@andrew.cmu.edu (dec 19 1989)
156  */
157
158 /* #define AMS */               /* use Andrew message system for mail */
159
160 /* NO_MAILREADER is for kerberos authenticating filesystems where it is
161  * essentially impossible to securely exec child processes, like mail
162  * readers, when the game is running under a special token.
163  *
164  *             dan
165  */
166
167 /* #define NO_MAILREADER */     /* have mail daemon just tell player of mail */
168
169 #ifdef  MAIL
170 # if defined(BSD) || defined(ULTRIX)
171 #  ifdef AMS
172 #define AMS_MAILBOX     "/Mailbox"
173 #  else
174 #   if defined(__FreeBSD__) || defined(__OpenBSD__)
175 #define DEF_MAILREADER  "/usr/bin/mail"
176 #   else
177 #define DEF_MAILREADER  "/usr/ucb/Mail"
178 #   endif
179 #  endif
180 #else
181 # if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
182 #  if defined(M_XENIX)
183 #define DEF_MAILREADER  "/usr/bin/mail"
184 #  else
185 #   ifdef __sgi
186 #define DEF_MAILREADER  "/usr/sbin/Mail"
187 #   else
188 #define DEF_MAILREADER  "/usr/bin/mailx"
189 #   endif
190 #  endif
191 # else
192 #define DEF_MAILREADER  "/bin/mail"
193 # endif
194 #endif
195
196 #define MAILCKFREQ      50
197 #endif  /* MAIL */
198
199
200
201 #ifdef COMPRESS
202 /* Some implementations of compress need a 'quiet' option.
203  * If you've got one of these versions, put -q here.
204  * You can also include any other strange options your compress needs.
205  * If you have a normal compress, just leave it commented out.
206  */
207 /* #define COMPRESS_OPTIONS "-q" */
208 #endif
209
210 #define FCMASK  0660    /* file creation mask */
211
212
213 /*
214  * The remainder of the file should not need to be changed.
215  */
216
217 #ifdef _AUX_SOURCE
218 # ifdef AUX /* gcc ? */
219 #  define _SYSV_SOURCE
220 #  define _BSD_SOURCE
221 #else
222 #  define AUX
223 # endif
224 #endif /* _AUX_SOURCE */
225
226 #if defined(LINUX) || defined(bsdi)
227 # ifndef POSIX_TYPES
228 #  define POSIX_TYPES
229 # endif
230 # ifndef POSIX_JOB_CONTROL
231 #  define POSIX_JOB_CONTROL
232 # endif
233 #endif
234
235 /*
236  * BSD/ULTRIX systems are normally the only ones that can suspend processes.
237  * Suspending NetHack processes cleanly should be easy to add to other systems
238  * that have SIGTSTP in the Berkeley sense.  Currently the only such systems
239  * known to work are HPUX and AIX 3.1; other systems will probably require
240  * tweaks to unixtty.c and ioctl.c.
241  *
242  * POSIX defines a slightly different type of job control, which should be
243  * equivalent for NetHack's purposes.  POSIX_JOB_CONTROL should work on
244  * various recent SYSV versions (with possibly tweaks to unixtty.c again).
245  */
246 #ifndef POSIX_JOB_CONTROL
247 # if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31)
248 #  define BSD_JOB_CONTROL
249 # else
250 #  if defined(SVR4)
251 #   define POSIX_JOB_CONTROL
252 #  endif
253 # endif
254 #endif
255 #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX)
256 #define SUSPEND         /* let ^Z suspend the game */
257 #endif
258
259
260 #if defined(BSD) || defined(ULTRIX)
261 #include <sys/time.h>
262 #else
263 #include <time.h>
264 #endif
265
266 #define HLOCK   "perm"  /* an empty file used for locking purposes */
267
268 #ifndef REDO
269 #define Getchar nhgetch
270 #endif
271 #define tgetch getchar
272
273 #define SHELL           /* do not delete the '!' command */
274
275 #include "system.h"
276
277 #if defined(POSIX_TYPES) || defined(__GNUC__)
278 #include <stdlib.h>
279 #include <unistd.h>
280 #endif
281
282 #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) || defined(ULTRIX)
283 #include <sys/wait.h>
284 #endif
285
286 #if defined(BSD) || defined(ULTRIX)
287 # if !defined(DGUX) && !defined(SUNOS4)
288 #define memcpy(d, s, n)         bcopy(s, d, n)
289 #define memcmp(s1, s2, n)       bcmp(s2, s1, n)
290 # endif
291 # ifdef SUNOS4
292 #include <memory.h>
293 # endif
294 #else   /* therefore SYSV */
295 # ifndef index  /* some systems seem to do this for you */
296 #define index   strchr
297 # endif
298 # ifndef rindex
299 #define rindex  strrchr
300 # endif
301 #endif
302
303 /* Use the high quality random number routines. */
304 #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__)
305 #define Rand()  random()
306 #else
307 #define Rand()  lrand48()
308 #endif
309
310 #ifdef TIMED_DELAY
311 # if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
312 # define msleep(k) usleep((k)*1000)
313 # endif
314 # ifdef ULTRIX
315 # define msleep(k) napms(k)
316 # endif
317 #endif
318
319 #ifdef hc       /* older versions of the MetaWare High-C compiler define this */
320 # ifdef __HC__
321 #  undef __HC__
322 # endif
323 # define __HC__ hc
324 # undef hc
325 #endif
326
327 #if defined(GNOME_GRAPHICS)
328 #if defined(LINUX)
329 # include <linux/unistd.h>
330 # if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */
331 #  define GETRES_SUPPORT
332 # endif
333 #else
334 # if defined(BSD) || defined(SVR4)
335 /*
336  * [ALI] We assume that SVR4 means we can safely include syscall.h
337  * (although it's really a BSDism). This is certainly true for Solaris 2.5,
338  * Solaris 7, Solaris 8 and Compaq Tru64 5.1
339  * Later BSD systems will have the getresid system calls.
340  */
341 # include <sys/syscall.h>
342 # if (defined (SYS_getuid) || defined(SYS_getresuid)) && \
343   (defined(SYS_getgid) || defined(SYS_getresgid))
344 #  define GETRES_SUPPORT
345 # endif
346 # endif /* BSD || SVR4 */
347 #endif /* LINUX */
348 #endif  /* GNOME_GRAPHICS */
349
350 #endif /* UNIXCONF_H */
351 #endif /* UNIX */