OSDN Git Service

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