OSDN Git Service

[Refactor] #37353 ALLOW_SPOILERS のプリプロが有効であることを前提とし、プリプロ自体は削除 / Removed ALLOW_SPOILER...
[hengband/hengband.git] / src / h-config.h
1 /*!
2  * @file h-config.h
3  * @brief 主に変愚/Zang時追加された基本事項のヘッダーファイル /
4  * The most basic "include" file. This file simply includes other low level header files.
5  * @date 2014/08/15
6  * @author
7  * 不明(変愚蛮怒スタッフ?)
8  * @details
9  * <pre>
10  * Choose the hardware, operating system, and compiler.
11  * Also, choose various "system level" compilation options.
12  * A lot of these definitions take effect in "h-system.h"
13  * Note that you may find it simpler to define some of these
14  * options in the "Makefile", especially any options describing
15  * what "system" is being used.
16  * no system definitions are needed for 4.3BSD, SUN OS, DG/UX
17  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
18  *
19  * This software may be copied and distributed for educational, research,
20  * and not for profit purposes provided that this copyright and statement
21  * are included in all such copies.  Other copyrights may also apply.
22 */
23
24 #ifndef INCLUDED_H_CONFIG_H
25 #define INCLUDED_H_CONFIG_H
26
27 /*
28  * OPTION: Compile on a Macintosh (see "A-mac-h" or "A-mac-pch")
29  * Automatic for Mac MPW compilation
30  */
31 #ifndef MACINTOSH
32 /* #define MACINTOSH */
33 #endif
34
35 /*
36  * OPTION: Compile on Windows (automatic)
37  */
38 #ifndef WINDOWS
39 /* #define WINDOWS */
40 #endif
41
42 /*
43  * Extract the "MAC_MPW" flag from the compiler
44  */
45 #if defined(__SC__) || defined(__MRC__)
46 # ifndef MACINTOSH
47 #  define MACINTOSH
48 # endif
49 # ifndef MAC_MPW
50 #  define MAC_MPW
51 # endif
52 #endif
53
54 /*
55  * OPTION: Compile on a HPUX version of UNIX
56  */
57 #ifndef HPUX
58 /* #define HPUX */
59 #endif
60
61 /*
62  * OPTION: Compile on an SGI running IRIX
63  */
64 #ifndef SGI
65 /* #define SGI */
66 #endif
67
68 /*
69  * OPTION: Compile on a Solaris machine
70  */
71 #ifndef SOLARIS
72 /* #define SOLARIS */
73 #endif
74
75 /*
76  * OPTION: Compile on an ultrix/4.2BSD/Dynix/etc. version of UNIX,
77  * Do not define this if you are on any kind of SunOS.
78  */
79 #ifndef ULTRIX
80 /* #define ULTRIX */
81 #endif
82
83
84 /*
85  * Extract the "ULTRIX" flag from the compiler
86  */
87 #if defined(ultrix) || defined(Pyramid)
88 # ifndef ULTRIX
89 #  define ULTRIX
90 # endif
91 #endif
92
93 /*
94  * Extract the "SGI" flag from the compiler
95  */
96 #ifdef sgi
97 # ifndef SGI
98 #  define SGI
99 # endif
100 #endif
101
102 /*
103  * Extract the "WINDOWS" flag from the compiler
104  */
105 #if defined(_Windows) || defined(__WINDOWS__) || \
106     defined(__WIN32__) || defined(WIN32) || \
107     defined(__WINNT__) || defined(__NT__)
108 # ifndef WINDOWS
109 #  define WINDOWS
110 # endif
111 #endif
112
113
114
115 /*
116  * OPTION: Define "L64" if a "long" is 64-bits.  See "h-types.h".
117  * The only such platform that angband is ported to is currently
118  * DEC Alpha AXP running OSF/1 (OpenVMS uses 32-bit longs).
119  */
120 #if defined(__alpha) && defined(__osf__)
121 # define L64
122 #endif
123
124
125
126 /*
127  * OPTION: set "SET_UID" if the machine is a "multi-user" machine.
128  * This option is used to verify the use of "uids" and "gids" for
129  * various "Unix" calls, and of "pids" for getting a random seed,
130  * and of the "umask()" call for various reasons, and to guess if
131  * the "kill()" function is available, and for permission to use
132  * functions to extract user names and expand "tildes" in filenames.
133  * It is also used for "locking" and "unlocking" the score file.
134  * Basically, SET_UID should *only* be set for "Unix" machines,
135  * or for the "Atari" platform which is Unix-like, apparently
136  */
137 #if !defined(MACINTOSH) && !defined(WINDOWS) && !defined(VM)
138 # define SET_UID
139 #endif
140
141
142 /*
143  * OPTION: Set "USG" for "System V" versions of Unix
144  * This is used to choose a "lock()" function, and to choose
145  * which header files ("string.h" vs "strings.h") to include.
146  * It is also used to allow certain other options, such as options
147  * involving userid's, or multiple users on a single machine, etc.
148  */
149 #ifdef SET_UID
150 # if defined(SOLARIS) || \
151      defined(HPUX) || defined(SGI)
152 #  ifndef USG
153 #   define USG
154 #  endif
155 # endif
156 #endif
157
158
159 /*
160  * Every system seems to use its own symbol as a path separator.
161  * Default to the standard Unix slash, but attempt to change this
162  * for various other systems.  Note that any system that uses the
163  * "period" as a separator will have to pretend that it uses the
164  * slash, and do its own mapping of period <-> slash.
165  * Note that the VM system uses a "flat" directory, and thus uses
166  * the empty string for "PATH_SEP".
167  */
168 #undef PATH_SEP
169 #define PATH_SEP "/"
170 #ifdef MACINTOSH
171 # undef PATH_SEP
172 # define PATH_SEP ":"
173 #endif
174 #if defined(WINDOWS) || defined(WINNT)
175 # undef PATH_SEP
176 # define PATH_SEP "\\"
177 #endif
178 #if defined(OS2)
179 # undef PATH_SEP
180 # define PATH_SEP "\\"
181 #endif
182 #ifdef __GO32__
183 # undef PATH_SEP
184 # define PATH_SEP "/"
185 #endif
186
187
188 /*
189  * The Macintosh allows the use of a "file type" when creating a file
190  */
191 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
192 # define FILE_TYPE_TEXT 'TEXT'
193 # define FILE_TYPE_DATA 'DATA'
194 # define FILE_TYPE_SAVE 'SAVE'
195 # define FILE_TYPE(X) (_ftype = (X))
196 #else
197 # define FILE_TYPE(X) ((void)0)
198 #endif
199
200
201 /*
202  * OPTION: Define "HAS_STRICMP" only if "stricmp()" exists.
203  * Note that "stricmp()" is not actually used by Angband.
204  */
205 /* #define HAS_STRICMP */
206
207 /*
208  * Linux has "stricmp()" with a different name
209  */
210 #if defined(linux)
211 # define HAS_STRICMP
212 # define stricmp strcasecmp
213 #endif
214
215
216 /*
217  * OPTION: Define "HAVE_USLEEP" only if "usleep()" exists.
218  *
219  * Note that this is only relevant for "SET_UID" machines.
220  * Note that new "SOLARIS" and "SGI" machines have "usleep()".
221  */
222 #if defined(SET_UID) && !defined(HAVE_CONFIG_H)
223 # if !defined(HPUX) && !defined(ULTRIX) && !defined(ISC)
224 #  define HAVE_USLEEP
225 # endif
226 #endif
227
228 #ifdef JP
229 # if defined(EUC)
230 #  define iskanji(x) (((unsigned char)(x) >= 0xa1 && (unsigned char)(x) <= 0xfe) || (unsigned char)(x) == 0x8e)
231 #  define iskana(x)  (0)
232 # elif defined(SJIS)
233 #  define iskanji(x) ((0x81 <= (unsigned char)(x) && (unsigned char)(x) <= 0x9f) || (0xe0 <= (unsigned char)(x) && (unsigned char)(x) <= 0xfc))
234 #  define iskana(x)  (((unsigned char)(x) >= 0xA0) && ((unsigned char)(x) <= 0xDF))
235 # else
236 #  error Oops! Please define "EUC" or "SJIS" for kanji-code of your system.
237 # endif
238 #endif
239
240 #endif /* INCLUDED_H_CONFIG_H */
241
242
243 /* Allow debug commands */
244 #define USE_DEBUG
245
246 /* Allow various special stuff (sound, graphics, etc.) */
247 #define USE_SPECIAL
248
249 #ifndef HAVE_CONFIG_H
250
251 /*
252  * USE_FONTSET and/or USE_XIM can be commented out
253  * when you don't want to use it.
254  */
255 #define USE_FONTSET
256
257 #ifdef JP
258 #define USE_XIM
259 #endif
260
261 #if defined(USE_FONTSET) || defined(USE_XIM)
262 #define USE_LOCALE
263 #endif
264
265 #if defined(JP) && !defined(USE_FONTSET)
266 #define USE_JP_FONTSTRUCT
267 #endif
268
269 #endif /* HAVE_CONFIG_H */
270
271
272 /*
273  * Look through the following lines, and where a comment includes the
274  * tag "OPTION:", examine the associated "#define" statements, and decide
275  * whether you wish to keep, comment, or uncomment them.  You should not
276  * have to modify any lines not indicated by "OPTION".
277  *
278  * Note: Also examine the "system" configuration file "h-config.h"
279  * and the variable initialization file "variable.c".  If you change
280  * anything in "variable.c", you only need to recompile that file.
281  *
282  * And finally, remember that the "Makefile" will specify some rather
283  * important compile time options, like what visual module to use.
284  */
285
286
287 /*
288  * OPTION: See the Makefile(s), where several options may be declared.
289  *
290  * Some popular options include "USE_GCU" (allow use with Unix "curses"),
291  * "USE_X11" (allow basic use with Unix X11), "USE_XAW" (allow use with
292  * Unix X11 plus the Athena Widget set), and "USE_CAP" (allow use with
293  * the "termcap" library, or with hard-coded vt100 terminals).
294  *
295  * The old "USE_NCU" option has been replaced with "USE_GCU".
296  *
297  * Several other such options are available for non-unix machines,
298  * such as "MACINTOSH", "WINDOWS".
299  *
300  * You may also need to specify the "system", using defines such as
301  * "SOLARIS" (for Solaris), etc, see "h-config.h" for more info.
302  */
303
304
305 /*
306  * OPTION: define "SPECIAL_BSD" for using certain versions of UNIX
307  * that use the 4.4BSD Lite version of Curses in "main-gcu.c"
308  */
309 /* #define SPECIAL_BSD */
310
311
312 /*
313  * OPTION: Use the POSIX "termios" methods in "main-gcu.c"
314  */
315 /* #define USE_TPOSIX */
316
317 /*
318  * OPTION: Use the "termio" methods in "main-gcu.c"
319  */
320 /* #define USE_TERMIO */
321
322 /*
323  * OPTION: Use the icky BSD "tchars" methods in "main-gcu.c"
324  */
325 /* #define USE_TCHARS */
326
327 /*
328  * OPTION: Include "ncurses.h" instead of "curses.h" in "main-gcu.c"
329  */
330 /* #define USE_NCURSES */
331
332
333 /*
334  * OPTION: for multi-user machines running the game setuid to some other
335  * user (like 'games') this SAFE_SETUID option allows the program to drop
336  * its privileges when saving files that allow for user specified pathnames.
337  * This lets the game be installed system wide without major security
338  * concerns.  There should not be any side effects on any machines.
339  *
340  * This will handle "gids" correctly once the permissions are set right.
341  */
342 #define SAFE_SETUID
343
344
345 /*
346  * This flag enables the "POSIX" methods for "SAFE_SETUID".
347  */
348 #ifdef _POSIX_SAVED_IDS
349 # define SAFE_SETUID_POSIX
350 #endif
351
352
353 /*
354  * Prevent problems on (non-Solaris) Suns using "SAFE_SETUID".
355  * The SAFE_SETUID code is weird, use it at your own risk...
356  */
357 #if !defined(SOLARIS)
358 # undef SAFE_SETUID_POSIX
359 #endif
360
361
362
363
364 /*
365  * OPTION: for the AFS distributed file system, define this to ensure that
366  * the program is secure with respect to the setuid code.  This option has
367  * not been tested (to the best of my knowledge).  This option may require
368  * some weird tricks with "player_uid" and such involving "defines".
369  * Note that this option used the AFS library routines Authenticate(),
370  * bePlayer(), beGames() to enforce the proper priviledges.
371  * You may need to turn "SAFE_SETUID" off to use this option.
372  */
373 /* #define SECURE */
374
375
376
377
378 /*
379  * OPTION: Verify savefile Checksums (Angband 2.7.0 and up)
380  * This option can help prevent "corruption" of savefiles, and also
381  * stop intentional modification by amateur users.
382  */
383 #define VERIFY_CHECKSUMS
384
385
386 /*
387  * OPTION: Forbid the use of "fiddled" savefiles.  As far as I can tell,
388  * a fiddled savefile is one with an internal timestamp different from
389  * the actual timestamp.  Thus, turning this option on forbids one from
390  * copying a savefile to a different name.  Combined with disabling the
391  * ability to save the game without quitting, and with some method of
392  * stopping the user from killing the process at the tombstone screen,
393  * this should prevent the use of backup savefiles.  It may also stop
394  * the use of savefiles from other platforms, so be careful.
395  */
396 /* #define VERIFY_TIMESTAMP */
397
398
399 /*
400  * OPTION: Forbid the "savefile over-write" cheat, in which you simply
401  * run another copy of the game, loading a previously saved savefile,
402  * and let that copy over-write the "dead" savefile later.  This option
403  * either locks the savefile, or creates a fake "xxx.lok" file to prevent
404  * the use of the savefile until the file is deleted.  Not ready yet.
405  */
406 /* #define VERIFY_SAVEFILE */
407
408
409
410 /*
411  * OPTION: Hack -- Compile in support for "Cyborg" mode
412  */
413 /*#define ALLOW_BORG*/
414
415 #ifdef USE_DEBUG
416
417 /*!
418  * @brief ウィザードモードへの移行を許可する / OPTION: Hack -- Compile in support for "Wizard Commands"
419  */
420 #define ALLOW_WIZARD
421
422 #endif /* USE_DEBUG */
423
424  /*
425  * OPTION: Handle signals
426  */
427 #define HANDLE_SIGNALS
428
429
430 /*
431  * Allow "Wizards" to yield "high scores"
432  */
433 /* #define SCORE_WIZARDS */
434
435 /*
436  * Allow "Borgs" to yield "high scores"
437  */
438 /*#define SCORE_BORGS*/
439
440 /*
441  * Allow "Cheaters" to yield "high scores"
442  */
443 /* #define SCORE_CHEATERS */
444
445
446 #ifdef USE_SPECIAL
447
448 /*
449  * OPTION: Allow the use of "sound" in various places.
450  */
451 #define USE_SOUND
452
453 /*
454  * OPTION: Allow the use of "graphics" in various places
455  */
456 #define USE_GRAPHICS
457
458 /*
459  * OPTION: Allow the use of "music" in various places
460  */
461 #define USE_MUSIC
462
463 #endif /* USE_SPECIAL */
464
465
466 /*
467  * OPTION: Set the "default" path to the angband "lib" directory.
468  *
469  * See "main.c" for usage, and note that this value is only used on
470  * certain machines, primarily Unix machines.  If this value is used,
471  * it will be over-ridden by the "ANGBAND_PATH" environment variable,
472  * if that variable is defined and accessable.  The final slash is
473  * optional, but it may eventually be required.
474  *
475  * Using the value "./lib/" below tells Angband that, by default,
476  * the user will run "angband" from the same directory that contains
477  * the "lib" directory.  This is a reasonable (but imperfect) default.
478  *
479  * If at all possible, you should change this value to refer to the
480  * actual location of the "lib" folder, for example, "/tmp/angband/lib/"
481  * or "/usr/games/lib/angband/", or "/pkg/angband/lib".
482  */
483 #ifndef DEFAULT_PATH
484 # define DEFAULT_PATH "./lib/"
485 #endif
486
487
488 /*
489  * OPTION: Create and use a hidden directory in the users home directory
490  * for storing pref-files and character-dumps.
491  */
492 #ifdef SET_UID
493 #define PRIVATE_USER_PATH "~/.angband"
494 #endif /* SET_UID */
495
496
497 /*
498  * On multiuser systems, add the "uid" to savefile names
499  */
500 #ifdef SET_UID
501 # define SAVEFILE_USE_UID
502 #endif
503
504
505 /*
506  * OPTION: Check the "time" against "lib/file/hours.txt"
507  */
508 /* #define CHECK_TIME */
509
510 /*
511  * OPTION: Check the "load" against "lib/file/load.txt"
512  * This may require the 'rpcsvs' library
513  */
514 /* #define CHECK_LOAD */
515
516
517 /*
518  * OPTION: For some brain-dead computers with no command line interface,
519  * namely Macintosh, there has to be some way of "naming" your savefiles.
520  * The current "Macintosh" hack is to make it so whenever the character
521  * name changes, the savefile is renamed accordingly.  But on normal
522  * machines, once you manage to "load" a savefile, it stays that way.
523  * Macintosh is particularly weird because you can load savefiles that
524  * are not contained in the "lib:save:" folder, and if you change the
525  * player's name, it will then save the savefile elsewhere.  Note that
526  * this also gives a method of "bypassing" the "VERIFY_TIMESTAMP" code.
527  */
528 /*
529 #if defined(MACINTOSH) || defined(WINDOWS)
530 # define SAVEFILE_MUTABLE
531 #endif
532 */
533
534 /*
535  * OPTION: Capitalize the "user_name" (for "default" player name)
536  * This option is only relevant on SET_UID machines.
537  */
538 #define CAPITALIZE_USER_NAME
539
540
541
542 /*
543  * OPTION: Person to bother if something goes wrong.
544  */
545 /* #define MAINTAINER   "rr9@angband.org" */
546 #define MAINTAINER      "echizen@users.sourceforge.jp"
547
548
549 #ifdef JP
550 #ifndef USE_FONTSET
551 /*
552  * OPTION: Default font (when using X11).
553  */
554 #define DEFAULT_X11_FONT  "a24"
555 #define DEFAULT_X11_KFONT "kanji24"
556 #define DEFAULT_X11_FONT_SUB  "a16"
557 #define DEFAULT_X11_KFONT_SUB "kanji16"
558
559
560 /*
561  * OPTION: Default fonts (when using X11)
562  */
563 #define DEFAULT_X11_FONT_0  DEFAULT_X11_FONT
564 #define DEFAULT_X11_KFONT_0 DEFAULT_X11_KFONT
565 #define DEFAULT_X11_FONT_1  DEFAULT_X11_FONT_SUB
566 #define DEFAULT_X11_KFONT_1 DEFAULT_X11_KFONT_SUB
567 #define DEFAULT_X11_FONT_2  DEFAULT_X11_FONT_SUB
568 #define DEFAULT_X11_KFONT_2 DEFAULT_X11_KFONT_SUB
569 #define DEFAULT_X11_FONT_3  DEFAULT_X11_FONT_SUB
570 #define DEFAULT_X11_KFONT_3 DEFAULT_X11_KFONT_SUB
571 #define DEFAULT_X11_FONT_4  DEFAULT_X11_FONT_SUB
572 #define DEFAULT_X11_KFONT_4 DEFAULT_X11_KFONT_SUB
573 #define DEFAULT_X11_FONT_5  DEFAULT_X11_FONT_SUB
574 #define DEFAULT_X11_KFONT_5 DEFAULT_X11_KFONT_SUB
575 #define DEFAULT_X11_FONT_6  DEFAULT_X11_FONT_SUB
576 #define DEFAULT_X11_KFONT_6 DEFAULT_X11_KFONT_SUB
577 #define DEFAULT_X11_FONT_7  DEFAULT_X11_FONT_SUB
578 #define DEFAULT_X11_KFONT_7 DEFAULT_X11_KFONT_SUB
579
580 #else
581 /*
582  * OPTION: Default font (when using X11).
583  */
584 #define DEFAULT_X11_FONT \
585         "-*-*-medium-r-normal--24-*-*-*-*-*-iso8859-1" \
586         ",-*-*-medium-r-normal--24-*-*-*-*-*-jisx0208.1983-0"
587 /*      "12x24" \
588         ",kanji24"*/
589 #define DEFAULT_X11_FONT_SUB \
590         "-*-*-medium-r-normal--16-*-*-*-*-*-iso8859-1" \
591         ",-*-*-medium-r-normal--16-*-*-*-*-*-jisx0208.1983-0"
592 /*      "8x16" \
593         ",kanji16"*/
594
595 /*
596  * OPTION: Default fonts (when using X11)
597  */
598 #define DEFAULT_X11_FONT_0              DEFAULT_X11_FONT
599 #define DEFAULT_X11_FONT_1              DEFAULT_X11_FONT_SUB
600 #define DEFAULT_X11_FONT_2              DEFAULT_X11_FONT_SUB
601 #define DEFAULT_X11_FONT_3              DEFAULT_X11_FONT_SUB
602 #define DEFAULT_X11_FONT_4              DEFAULT_X11_FONT_SUB
603 #define DEFAULT_X11_FONT_5              DEFAULT_X11_FONT_SUB
604 #define DEFAULT_X11_FONT_6              DEFAULT_X11_FONT_SUB
605 #define DEFAULT_X11_FONT_7              DEFAULT_X11_FONT_SUB
606 #endif
607
608 #else
609 /*
610  * OPTION: Default font (when using X11).
611  */
612 #define DEFAULT_X11_FONT                "9x15"
613
614 /*
615  * OPTION: Default fonts (when using X11)
616  */
617 #define DEFAULT_X11_FONT_0              "10x20"
618 #define DEFAULT_X11_FONT_1              "9x15"
619 #define DEFAULT_X11_FONT_2              "9x15"
620 #define DEFAULT_X11_FONT_3              "5x8"
621 #define DEFAULT_X11_FONT_4              "5x8"
622 #define DEFAULT_X11_FONT_5              "5x8"
623 #define DEFAULT_X11_FONT_6              "5x8"
624 #define DEFAULT_X11_FONT_7              "5x8"
625 #endif
626
627
628 /*
629  * OPTION: Gamma correct X11 colours.
630  */
631  
632 #define SUPPORT_GAMMA
633
634 /*
635  * Hack -- Mach-O (native binary format of OS X) is basically a Un*x
636  * but has Mac OS/Windows-like user interface
637  */
638 #ifdef MACH_O_CARBON
639 # ifdef PRIVATE_USER_PATH
640 #  undef PRIVATE_USER_PATH
641 # endif
642 # ifdef SAVEFILE_USE_UID
643 #  undef SAVEFILE_USE_UID
644 # endif
645 #endif
646
647 /*
648  * OPTION: Attempt to prevent all "cheating"
649  */
650 /* #define VERIFY_HONOR */
651
652
653 /*
654  * React to the "VERIFY_HONOR" flag
655  */
656 #ifdef VERIFY_HONOR
657 # define VERIFY_SAVEFILE
658 # define VERIFY_CHECKSUMS
659 # define VERIFY_TIMESTAMPS
660 #endif
661
662 /*
663  * Check the modification time of *_info.raw files
664  * (by Keldon Jones)
665  */
666 #ifndef MAC_MPW
667 #define CHECK_MODIFICATION_TIME
668 #endif
669
670 /*
671  * Use the new sorting routines for creation
672  * of the monster allocation table
673  */
674 #define SORT_R_INFO
675
676
677 #ifndef HAVE_CONFIG_H
678 #define WORLD_SCORE
679 #endif /* HAVE_CONFIG_H */