1 | /* SCCS Id: @(#)unixconf.h 3.3 99/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 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/snd86.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 | #define DEF_MAILREADER "/usr/ucb/Mail" 175 | # endif 176 | #else 177 | # if defined(SYSV) || defined(DGUX) || defined(HPUX) 178 | # if defined(M_XENIX) || defined(__FreeBSD__) 179 | #define DEF_MAILREADER "/usr/bin/mail" 180 | # else 181 | # ifdef __sgi 182 | #define DEF_MAILREADER "/usr/sbin/Mail" 183 | # else 184 | #define DEF_MAILREADER "/usr/bin/mailx" 185 | # endif 186 | # endif 187 | # else 188 | #define DEF_MAILREADER "/bin/mail" 189 | # endif 190 | #endif 191 | 192 | #define MAILCKFREQ 50 193 | #endif /* MAIL */ 194 | 195 | 196 | 197 | #ifdef COMPRESS 198 | /* Some implementations of compress need a 'quiet' option. 199 | * If you've got one of these versions, put -q here. 200 | * You can also include any other strange options your compress needs. 201 | * If you have a normal compress, just leave it commented out. 202 | */ 203 | /* #define COMPRESS_OPTIONS "-q" */ 204 | #endif 205 | 206 | #define FCMASK 0660 /* file creation mask */ 207 | 208 | 209 | /* 210 | * The remainder of the file should not need to be changed. 211 | */ 212 | 213 | #ifdef _AUX_SOURCE 214 | # ifdef AUX /* gcc ? */ 215 | # define _SYSV_SOURCE 216 | # define _BSD_SOURCE 217 | #else 218 | # define AUX 219 | # endif 220 | #endif /* _AUX_SOURCE */ 221 | 222 | #if defined(LINUX) || defined(bsdi) 223 | # ifndef POSIX_TYPES 224 | # define POSIX_TYPES 225 | # endif 226 | # ifndef POSIX_JOB_CONTROL 227 | # define POSIX_JOB_CONTROL 228 | # endif 229 | #endif 230 | 231 | /* 232 | * BSD/ULTRIX systems are normally the only ones that can suspend processes. 233 | * Suspending NetHack processes cleanly should be easy to add to other systems 234 | * that have SIGTSTP in the Berkeley sense. Currently the only such systems 235 | * known to work are HPUX and AIX 3.1; other systems will probably require 236 | * tweaks to unixtty.c and ioctl.c. 237 | * 238 | * POSIX defines a slightly different type of job control, which should be 239 | * equivalent for NetHack's purposes. POSIX_JOB_CONTROL should work on 240 | * various recent SYSV versions (with possibly tweaks to unixtty.c again). 241 | */ 242 | #ifndef POSIX_JOB_CONTROL 243 | # if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31) 244 | # define BSD_JOB_CONTROL 245 | # else 246 | # if defined(SVR4) 247 | # define POSIX_JOB_CONTROL 248 | # endif 249 | # endif 250 | #endif 251 | #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX) 252 | #define SUSPEND /* let ^Z suspend the game */ 253 | #endif 254 | 255 | 256 | #if defined(BSD) || defined(ULTRIX) 257 | #include <sys/time.h> 258 | #else 259 | #include <time.h> 260 | #endif 261 | 262 | #define HLOCK "perm" /* an empty file used for locking purposes */ 263 | 264 | #ifndef REDO 265 | #define Getchar nhgetch 266 | #endif 267 | #define tgetch getchar 268 | 269 | #define SHELL /* do not delete the '!' command */ 270 | 271 | #include "system.h" 272 | 273 | #if defined(POSIX_TYPES) || defined(__GNUC__) 274 | #include <stdlib.h> 275 | #include <unistd.h> 276 | #endif 277 | 278 | #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) || defined(ULTRIX) 279 | #include <sys/wait.h> 280 | #endif 281 | 282 | #if defined(BSD) || defined(ULTRIX) 283 | # if !defined(DGUX) && !defined(SUNOS4) 284 | #define memcpy(d, s, n) bcopy(s, d, n) 285 | #define memcmp(s1, s2, n) bcmp(s2, s1, n) 286 | # endif 287 | # ifdef SUNOS4 288 | #include <memory.h> 289 | # endif 290 | #else /* therefore SYSV */ 291 | # ifndef index /* some systems seem to do this for you */ 292 | #define index strchr 293 | # endif 294 | # ifndef rindex 295 | #define rindex strrchr 296 | # endif 297 | #endif 298 | 299 | /* Use the high quality random number routines. */ 300 | #if defined(BSD) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) 301 | #define Rand() random() 302 | #else 303 | #define Rand() lrand48() 304 | #endif 305 | 306 | #ifdef TIMED_DELAY 307 | # if defined(SUNOS4) || defined(LINUX) 308 | # define msleep(k) usleep((k)*1000) 309 | # endif 310 | # ifdef ULTRIX 311 | # define msleep(k) napms(k) 312 | # endif 313 | #endif 314 | 315 | #ifdef hc /* older versions of the MetaWare High-C compiler define this */ 316 | # ifdef __HC__ 317 | # undef __HC__ 318 | # endif 319 | # define __HC__ hc 320 | # undef hc 321 | #endif 322 | 323 | #endif /* UNIXCONF_H */ 324 | #endif /* UNIX */