OSDN Git Service

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