OSDN Git Service

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