OSDN Git Service

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