00001 /* SCCS Id: @(#)unixconf.h 3.4 1999/07/02 */ 00002 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 00003 /* NetHack may be freely redistributed. See license for details. */ 00004 00005 #ifdef UNIX 00006 #ifndef UNIXCONF_H 00007 #define UNIXCONF_H 00008 00009 /* 00010 * Some include files are in a different place under SYSV 00011 * BSD SYSV 00012 * <sys/time.h> <time.h> 00013 * <sgtty.h> <termio.h> 00014 * 00015 * Some routines are called differently 00016 * index strchr 00017 * rindex strrchr 00018 * 00019 */ 00020 00021 /* define exactly one of the following four choices */ 00022 /* #define BSD 1 */ /* define for 4.n/Free/Open/Net BSD */ 00023 /* also for relatives like SunOS 4.x, DG/UX, and */ 00024 /* older versions of Linux */ 00025 /* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */ 00026 /* Use BSD for < v3.0 */ 00027 /* "ULTRIX" not to be confused with "ultrix" */ 00028 #define SYSV /* define for System V, Solaris 2.x, newer versions */ 00029 /* of Linux */ 00030 /* #define HPUX */ /* Hewlett-Packard's Unix, version 6.5 or higher */ 00031 /* use SYSV for < v6.5 */ 00032 00033 00034 /* define any of the following that are appropriate */ 00035 #define SVR4 /* use in addition to SYSV for System V Release 4 */ 00036 /* including Solaris 2+ */ 00037 #define NETWORK /* if running on a networked system */ 00038 /* e.g. Suns sharing a playground through NFS */ 00039 /* #define SUNOS4 */ /* SunOS 4.x */ 00040 /* #define LINUX */ /* Another Unix clone */ 00041 /* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */ 00042 /* #define GENIX */ /* Yet Another Unix Clone */ 00043 /* #define HISX */ /* Bull Unix for XPS Machines */ 00044 /* #define BOS */ /* Bull Open Software - Unix for DPX/2 Machines */ 00045 /* #define UNIXPC */ /* use in addition to SYSV for AT&T 7300/3B1 */ 00046 /* #define AIX_31 */ /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain 00047 * job control (note that AIX is SYSV otherwise) 00048 * Also define this for AIX 3.2 */ 00049 00050 #define TERMINFO /* uses terminfo rather than termcap */ 00051 /* Should be defined for most SYSV, SVR4 (including 00052 * Solaris 2+), HPUX, and Linux systems. In 00053 * particular, it should NOT be defined for the UNIXPC 00054 * unless you remove the use of the shared library in 00055 * the Makefile */ 00056 #define TEXTCOLOR /* Use System V r3.2 terminfo color support */ 00057 /* and/or ANSI color support on termcap systems */ 00058 /* and/or X11 color */ 00059 #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control */ 00060 /* (e.g., VSUSP) */ 00061 #define POSIX_TYPES /* use POSIX types for system calls and termios */ 00062 /* Define for many recent OS releases, including 00063 * those with specific defines (since types are 00064 * changing toward the standard from earlier chaos). 00065 * For example, platforms using the GNU libraries, 00066 * Linux, Solaris 2.x 00067 */ 00068 00069 /* #define OPENWINBUG */ /* avoid a problem using OpenWindows 3.0 for 00070 X11 on SunOS 4.1.x, x>= 2. Do not define 00071 for other X11 implementations. */ 00072 /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */ 00073 /* #define BSD_43_BUG */ /* for real 4.3BSD cc's without schain botch fix */ 00074 /* #define MICROPORT_BUG */ /* problems with large arrays in structs */ 00075 /* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to 00076 run with Microport Sys V/AT version 2.4. 00077 By Jay Maynard */ 00078 /* #define AIXPS_2BUG */ /* avoid a problem with little_to_big() optimization */ 00079 00080 /* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48 00081 is available from your system */ 00082 00083 /* see sys/unix/snd86unx.shr for more information on these */ 00084 /* #define UNIX386MUSIC */ /* play real music through speaker on systems 00085 with music driver installed */ 00086 /* #define VPIX_MUSIC */ /* play real music through speaker on systems 00087 with built-in VPIX support */ 00088 00089 00090 /* 00091 * The next two defines are intended mainly for the Andrew File System, 00092 * which does not allow hard links. If NO_FILE_LINKS is defined, lock files 00093 * will be created in LOCKDIR using open() instead of in the playground using 00094 * link(). 00095 * Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88) 00096 */ 00097 00098 /* #define NO_FILE_LINKS */ /* if no hard links */ 00099 /* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */ 00100 00101 /* 00102 * If you want the static parts of your playground on a read-only file 00103 * system, define VAR_PLAYGROUND to be where the variable parts are kept. 00104 */ 00105 /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */ 00106 00107 00108 /* 00109 * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more" 00110 * If defined, it can be overridden by the environment variable PAGER. 00111 * Hack will use its internal pager if DEF_PAGER is not defined. 00112 * (This might be preferable for security reasons.) 00113 * #define DEF_PAGER ".../mydir/mypager" 00114 */ 00115 00116 00117 00118 /* 00119 * Define PORT_HELP to be the name of the port-specfic help file. 00120 * This file is found in HACKDIR. 00121 * Normally, you shouldn't need to change this. 00122 * There is currently no port-specific help for Unix systems. 00123 */ 00124 /* #define PORT_HELP "Unixhelp" */ 00125 00126 #ifdef TTY_GRAPHICS 00127 /* 00128 * To enable the `timed_delay' option for using a timer rather than extra 00129 * screen output when pausing for display effect. Requires that `msleep' 00130 * function be available (with time argument specified in milliseconds). 00131 * Various output devices can produce wildly varying delays when the 00132 * "extra output" method is used, but not all systems provide access to 00133 * a fine-grained timer. 00134 */ 00135 #ifndef AUTOCONF 00136 /* #define TIMED_DELAY */ /* usleep() */ 00137 #endif 00138 #endif 00139 00140 /* 00141 * If you define MAIL, then the player will be notified of new mail 00142 * when it arrives. If you also define DEF_MAILREADER then this will 00143 * be the default mail reader, and can be overridden by the environment 00144 * variable MAILREADER; otherwise an internal pager will be used. 00145 * A stat system call is done on the mailbox every MAILCKFREQ moves. 00146 */ 00147 00148 #define MAIL /* Deliver mail during the game */ 00149 00150 /* The Andrew Message System does mail a little differently from normal 00151 * UNIX. Mail is deposited in the user's own directory in ~/Mailbox 00152 * (another directory). MAILBOX is the element that will be added on to 00153 * the user's home directory path to generate the Mailbox path - just in 00154 * case other Andrew sites do it differently from CMU. 00155 * 00156 * dan lovinger 00157 * dl2n+@andrew.cmu.edu (dec 19 1989) 00158 */ 00159 00160 /* #define AMS */ /* use Andrew message system for mail */ 00161 00162 /* NO_MAILREADER is for kerberos authenticating filesystems where it is 00163 * essentially impossible to securely exec child processes, like mail 00164 * readers, when the game is running under a special token. 00165 * 00166 * dan 00167 */ 00168 00169 /* #define NO_MAILREADER */ /* have mail daemon just tell player of mail */ 00170 00171 #ifdef MAIL 00172 # if defined(BSD) || defined(ULTRIX) 00173 # ifdef AMS 00174 #define AMS_MAILBOX "/Mailbox" 00175 # else 00176 # if defined(__FreeBSD__) || defined(__OpenBSD__) 00177 #define DEF_MAILREADER "/usr/bin/mail" 00178 # else 00179 #define DEF_MAILREADER "/usr/ucb/Mail" 00180 # endif 00181 # endif 00182 #else 00183 # if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX) 00184 # if defined(M_XENIX) 00185 #define DEF_MAILREADER "/usr/bin/mail" 00186 # else 00187 # ifdef __sgi 00188 #define DEF_MAILREADER "/usr/sbin/Mail" 00189 # else 00190 #define DEF_MAILREADER "/usr/bin/mailx" 00191 # endif 00192 # endif 00193 # else 00194 #define DEF_MAILREADER "/bin/mail" 00195 # endif 00196 #endif 00197 00198 #endif /* MAIL */ 00199 00200 00201 00202 #ifdef COMPRESS 00203 /* Some implementations of compress need a 'quiet' option. 00204 * If you've got one of these versions, put -q here. 00205 * You can also include any other strange options your compress needs. 00206 * If you have a normal compress, just leave it commented out. 00207 */ 00208 /* #define COMPRESS_OPTIONS "-q" */ 00209 #endif 00210 00211 #define FCMASK 0660 /* file creation mask */ 00212 00213 /* fcntl(2) is a POSIX-portable call for manipulating file descriptors. 00214 * Comment out the USE_FCNTL if for some reason you have a strange 00215 * os/filesystem combination for which fcntl(2) does not work. */ 00216 #ifdef HAVE_FCNTL 00217 # define USE_FCNTL 00218 #endif 00219 00220 /* 00221 * The remainder of the file should not need to be changed. 00222 */ 00223 00224 #ifdef _AUX_SOURCE 00225 # ifdef AUX /* gcc ? */ 00226 # define _SYSV_SOURCE 00227 # define _BSD_SOURCE 00228 #else 00229 # define AUX 00230 # endif 00231 #endif /* _AUX_SOURCE */ 00232 00233 #if defined(LINUX) || defined(bsdi) 00234 # ifndef POSIX_TYPES 00235 # define POSIX_TYPES 00236 # endif 00237 # ifndef POSIX_JOB_CONTROL 00238 # define POSIX_JOB_CONTROL 00239 # endif 00240 #endif 00241 00242 /* 00243 * BSD/ULTRIX systems are normally the only ones that can suspend processes. 00244 * Suspending NetHack processes cleanly should be easy to add to other systems 00245 * that have SIGTSTP in the Berkeley sense. Currently the only such systems 00246 * known to work are HPUX and AIX 3.1; other systems will probably require 00247 * tweaks to unixtty.c and ioctl.c. 00248 * 00249 * POSIX defines a slightly different type of job control, which should be 00250 * equivalent for NetHack's purposes. POSIX_JOB_CONTROL should work on 00251 * various recent SYSV versions (with possibly tweaks to unixtty.c again). 00252 */ 00253 #ifndef POSIX_JOB_CONTROL 00254 # if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31) 00255 # define BSD_JOB_CONTROL 00256 # else 00257 # if defined(SVR4) 00258 # define POSIX_JOB_CONTROL 00259 # endif 00260 # endif 00261 #endif 00262 #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX) 00263 #define SUSPEND /* let ^Z suspend the game */ 00264 #endif 00265 00266 00267 #if defined(BSD) || defined(ULTRIX) 00268 #include <sys/time.h> 00269 #else 00270 #include <time.h> 00271 #endif 00272 00273 #define HLOCK "perm" /* an empty file used for locking purposes */ 00274 00275 #include "system.h" 00276 00277 #ifndef REDO 00278 #define Getchar nhgetch 00279 #endif 00280 #define tgetch getchar 00281 00282 #define SHELL /* do not delete the '!' command */ 00283 00284 #if defined(POSIX_TYPES) || defined(__GNUC__) 00285 #include <stdlib.h> 00286 #include <unistd.h> 00287 #endif 00288 00289 #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) || defined(ULTRIX) 00290 #include <sys/wait.h> 00291 #endif 00292 00293 #if defined(BSD) || defined(ULTRIX) 00294 # if !defined(DGUX) && !defined(SUNOS4) 00295 #define memcpy(d, s, n) bcopy(s, d, n) 00296 #define memcmp(s1, s2, n) bcmp(s2, s1, n) 00297 # endif 00298 # ifdef SUNOS4 00299 #include <memory.h> 00300 # endif 00301 #else /* therefore SYSV */ 00302 # ifndef index /* some systems seem to do this for you */ 00303 #define index strchr 00304 # endif 00305 # ifndef rindex 00306 #define rindex strrchr 00307 # endif 00308 #endif 00309 00310 /* Use the high quality random number routines. */ 00311 #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__) 00312 #define Rand() random() 00313 #else 00314 #define Rand() lrand48() 00315 #endif 00316 00317 #ifdef TIMED_DELAY 00318 # if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX)) 00319 # define msleep(k) usleep((k)*1000) 00320 # endif 00321 # ifdef ULTRIX 00322 # define msleep(k) napms(k) 00323 # endif 00324 #endif 00325 00326 #ifdef hc /* older versions of the MetaWare High-C compiler define this */ 00327 # ifdef __HC__ 00328 # undef __HC__ 00329 # endif 00330 # define __HC__ hc 00331 # undef hc 00332 #endif 00333 00334 #if defined(GNOME_GRAPHICS) 00335 #if defined(LINUX) 00336 # include <linux/unistd.h> 00337 # if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */ 00338 # define GETRES_SUPPORT 00339 # endif 00340 #else 00341 # if defined(BSD) || defined(SVR4) 00342 /* 00343 * [ALI] We assume that SVR4 means we can safely include syscall.h 00344 * (although it's really a BSDism). This is certainly true for Solaris 2.5, 00345 * Solaris 7, Solaris 8 and Compaq Tru64 5.1 00346 * Later BSD systems will have the getresid system calls. 00347 */ 00348 # include <sys/syscall.h> 00349 # if (defined (SYS_getuid) || defined(SYS_getresuid)) && \ 00350 (defined(SYS_getgid) || defined(SYS_getresgid)) 00351 # define GETRES_SUPPORT 00352 # endif 00353 # endif /* BSD || SVR4 */ 00354 #endif /* LINUX */ 00355 #endif /* GNOME_GRAPHICS */ 00356 00357 #endif /* UNIXCONF_H */ 00358 #endif /* UNIX */