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 #ifndef AUTOCONF
136 /* #define TIMED_DELAY */	/* usleep() */
137 #endif
138 #endif
139 
140 /*
141  * If you define MAIL, then the player will be notified of new mail
142  * when it arrives.  If you also define DEF_MAILREADER then this will
143  * be the default mail reader, and can be overridden by the environment
144  * variable MAILREADER; otherwise an internal pager will be used.
145  * A stat system call is done on the mailbox every MAILCKFREQ moves.
146  */
147 
148 #define MAIL			/* Deliver mail during the game */
149 
150 /* The Andrew Message System does mail a little differently from normal
151  * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
152  * (another directory).  MAILBOX is the element that will be added on to
153  * the user's home directory path to generate the Mailbox path - just in
154  * case other Andrew sites do it differently from CMU.
155  *
156  *		dan lovinger
157  *		dl2n+@andrew.cmu.edu (dec 19 1989)
158  */
159 
160 /* #define AMS */		/* use Andrew message system for mail */
161 
162 /* NO_MAILREADER is for kerberos authenticating filesystems where it is
163  * essentially impossible to securely exec child processes, like mail
164  * readers, when the game is running under a special token.
165  *
166  *	       dan
167  */
168 
169 /* #define NO_MAILREADER */	/* have mail daemon just tell player of mail */
170 
171 #ifdef	MAIL
172 # if defined(BSD) || defined(ULTRIX)
173 #  ifdef AMS
174 #define AMS_MAILBOX	"/Mailbox"
175 #  else
176 #   if defined(__FreeBSD__) || defined(__OpenBSD__)
177 #define DEF_MAILREADER	"/usr/bin/mail"
178 #   else
179 #define DEF_MAILREADER	"/usr/ucb/Mail"
180 #   endif
181 #  endif
182 #else
183 # if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
184 #  if defined(M_XENIX)
185 #define DEF_MAILREADER	"/usr/bin/mail"
186 #  else
187 #   ifdef __sgi
188 #define DEF_MAILREADER	"/usr/sbin/Mail"
189 #   else
190 #define DEF_MAILREADER	"/usr/bin/mailx"
191 #   endif
192 #  endif
193 # else
194 #define DEF_MAILREADER	"/bin/mail"
195 # endif
196 #endif
197 
198 #endif	/* MAIL */
199 
200 
201 
202 #ifdef COMPRESS
203 /* Some implementations of compress need a 'quiet' option.
204  * If you've got one of these versions, put -q here.
205  * You can also include any other strange options your compress needs.
206  * If you have a normal compress, just leave it commented out.
207  */
208 /* #define COMPRESS_OPTIONS "-q" */
209 #endif
210 
211 #define FCMASK	0660	/* file creation mask */
212 
213 /* fcntl(2) is a POSIX-portable call for manipulating file descriptors.
214  * Comment out the USE_FCNTL if for some reason you have a strange
215  * os/filesystem combination for which fcntl(2) does not work. */
216 #ifdef HAVE_FCNTL
217 # define USE_FCNTL
218 #endif
219 
220 /*
221  * The remainder of the file should not need to be changed.
222  */
223 
224 #ifdef _AUX_SOURCE
225 # ifdef AUX /* gcc ? */
226 #  define _SYSV_SOURCE
227 #  define _BSD_SOURCE
228 #else
229 #  define AUX
230 # endif
231 #endif /* _AUX_SOURCE */
232 
233 #if defined(LINUX) || defined(bsdi)
234 # ifndef POSIX_TYPES
235 #  define POSIX_TYPES
236 # endif
237 # ifndef POSIX_JOB_CONTROL
238 #  define POSIX_JOB_CONTROL
239 # endif
240 #endif
241 
242 /*
243  * BSD/ULTRIX systems are normally the only ones that can suspend processes.
244  * Suspending NetHack processes cleanly should be easy to add to other systems
245  * that have SIGTSTP in the Berkeley sense.  Currently the only such systems
246  * known to work are HPUX and AIX 3.1; other systems will probably require
247  * tweaks to unixtty.c and ioctl.c.
248  *
249  * POSIX defines a slightly different type of job control, which should be
250  * equivalent for NetHack's purposes.  POSIX_JOB_CONTROL should work on
251  * various recent SYSV versions (with possibly tweaks to unixtty.c again).
252  */
253 #ifndef POSIX_JOB_CONTROL
254 # if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31)
255 #  define BSD_JOB_CONTROL
256 # else
257 #  if defined(SVR4)
258 #   define POSIX_JOB_CONTROL
259 #  endif
260 # endif
261 #endif
262 #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX)
263 #define SUSPEND		/* let ^Z suspend the game */
264 #endif
265 
266 
267 #if defined(BSD) || defined(ULTRIX)
268 #include <sys/time.h>
269 #else
270 #include <time.h>
271 #endif
272 
273 #define HLOCK	"perm"	/* an empty file used for locking purposes */
274 
275 #include "system.h"
276 
277 #ifndef REDO
278 #define Getchar nhgetch
279 #endif
280 #define tgetch getchar
281 
282 #define SHELL		/* do not delete the '!' command */
283 
284 #if defined(POSIX_TYPES) || defined(__GNUC__)
285 #include <stdlib.h>
286 #include <unistd.h>
287 #endif
288 
289 #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) || defined(ULTRIX)
290 #include <sys/wait.h>
291 #endif
292 
293 #if defined(BSD) || defined(ULTRIX)
294 # if !defined(DGUX) && !defined(SUNOS4)
295 #define memcpy(d, s, n)		bcopy(s, d, n)
296 #define memcmp(s1, s2, n)	bcmp(s2, s1, n)
297 # endif
298 # ifdef SUNOS4
299 #include <memory.h>
300 # endif
301 #else	/* therefore SYSV */
302 # ifndef index	/* some systems seem to do this for you */
303 #define index	strchr
304 # endif
305 # ifndef rindex
306 #define rindex	strrchr
307 # endif
308 #endif
309 
310 /* Use the high quality random number routines. */
311 #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__)
312 #define Rand()	random()
313 #else
314 #define Rand()	lrand48()
315 #endif
316 
317 #ifdef TIMED_DELAY
318 # if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
319 # define msleep(k) usleep((k)*1000)
320 # endif
321 # ifdef ULTRIX
322 # define msleep(k) napms(k)
323 # endif
324 #endif
325 
326 #ifdef hc	/* older versions of the MetaWare High-C compiler define this */
327 # ifdef __HC__
328 #  undef __HC__
329 # endif
330 # define __HC__ hc
331 # undef hc
332 #endif
333 
334 #if defined(GNOME_GRAPHICS)
335 #if defined(LINUX)
336 # include <linux/unistd.h>
337 # if defined(__NR_getresuid) && defined(__NR_getresgid)	/* ie., >= v2.1.44 */
338 #  define GETRES_SUPPORT
339 # endif
340 #else
341 # if defined(BSD) || defined(SVR4)
342 /*
343  * [ALI] We assume that SVR4 means we can safely include syscall.h
344  * (although it's really a BSDism). This is certainly true for Solaris 2.5,
345  * Solaris 7, Solaris 8 and Compaq Tru64 5.1
346  * Later BSD systems will have the getresid system calls.
347  */
348 # include <sys/syscall.h>
349 # if (defined (SYS_getuid) || defined(SYS_getresuid)) && \
350   (defined(SYS_getgid) || defined(SYS_getresgid))
351 #  define GETRES_SUPPORT
352 # endif
353 # endif	/* BSD || SVR4 */
354 #endif /* LINUX */
355 #endif	/* GNOME_GRAPHICS */
356 
357 #endif /* UNIXCONF_H */
358 #endif /* UNIX */
359