1 |
/* |
2 |
* sysdeps.h - Try to include the right system headers and get other |
3 |
* system-specific stuff right |
4 |
* |
5 |
* Frodo (C) 1994-1997,2002 Christian Bauer |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License as published by |
9 |
* the Free Software Foundation; either version 2 of the License, or |
10 |
* (at your option) any later version. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
*/ |
21 |
|
22 |
#include "sysconfig.h" |
23 |
|
24 |
extern "C" |
25 |
{ |
26 |
|
27 |
#include <stdio.h> |
28 |
#include <stdlib.h> |
29 |
#include <assert.h> |
30 |
#include <ctype.h> |
31 |
|
32 |
#ifndef __PSXOS__ |
33 |
#include <errno.h> |
34 |
#include <signal.h> |
35 |
#endif |
36 |
|
37 |
#ifdef HAVE_SYS_TYPES_H |
38 |
#include <sys/types.h> |
39 |
#endif |
40 |
|
41 |
#ifdef HAVE_VALUES_H |
42 |
#include <values.h> |
43 |
#endif |
44 |
|
45 |
#ifdef HAVE_STRINGS_H |
46 |
#include <strings.h> |
47 |
#endif |
48 |
#ifdef HAVE_STRING_H |
49 |
#include <string.h> |
50 |
#endif |
51 |
|
52 |
#ifdef HAVE_UNISTD_H |
53 |
#include <unistd.h> |
54 |
#endif |
55 |
#ifdef HAVE_FCNTL_H |
56 |
#include <fcntl.h> |
57 |
#endif |
58 |
|
59 |
#ifdef HAVE_UTIME_H |
60 |
#include <utime.h> |
61 |
#endif |
62 |
|
63 |
#ifdef HAVE_SYS_PARAM_H |
64 |
#include <sys/param.h> |
65 |
#endif |
66 |
|
67 |
#ifdef HAVE_SYS_SELECT_H |
68 |
#include <sys/select.h> |
69 |
#endif |
70 |
|
71 |
#ifdef HAVE_SYS_VFS_H |
72 |
#include <sys/vfs.h> |
73 |
#endif |
74 |
|
75 |
#ifdef HAVE_SYS_STAT_H |
76 |
#include <sys/stat.h> |
77 |
#endif |
78 |
|
79 |
#ifdef HAVE_SYS_MOUNT_H |
80 |
#include <sys/mount.h> |
81 |
#endif |
82 |
|
83 |
#ifdef HAVE_SYS_STATFS_H |
84 |
#include <sys/statfs.h> |
85 |
#endif |
86 |
|
87 |
#ifdef HAVE_SYS_STATVFS_H |
88 |
#include <sys/statvfs.h> |
89 |
#endif |
90 |
|
91 |
#if TIME_WITH_SYS_TIME |
92 |
# include <sys/time.h> |
93 |
# include <time.h> |
94 |
#else |
95 |
# if HAVE_SYS_TIME_H |
96 |
# include <sys/time.h> |
97 |
# else |
98 |
#ifndef __PSXOS__ |
99 |
# include <time.h> |
100 |
#endif |
101 |
# endif |
102 |
#endif |
103 |
|
104 |
#if HAVE_DIRENT_H |
105 |
# include <dirent.h> |
106 |
#else |
107 |
# define dirent direct |
108 |
# if HAVE_SYS_NDIR_H |
109 |
# include <sys/ndir.h> |
110 |
# endif |
111 |
# if HAVE_SYS_DIR_H |
112 |
# include <sys/dir.h> |
113 |
# endif |
114 |
# if HAVE_NDIR_H |
115 |
# include <ndir.h> |
116 |
# endif |
117 |
#endif |
118 |
|
119 |
#ifndef __PSXOS__ |
120 |
#include <errno.h> |
121 |
#endif |
122 |
#include <assert.h> |
123 |
|
124 |
#if EEXIST == ENOTEMPTY |
125 |
#define BROKEN_OS_PROBABLY_AIX |
126 |
#endif |
127 |
|
128 |
#ifdef HAVE_LINUX_JOYSTICK_H |
129 |
#include <linux/joystick.h> |
130 |
#endif |
131 |
|
132 |
#ifdef __NeXT__ |
133 |
#define S_IRUSR S_IREAD |
134 |
#define S_IWUSR S_IWRITE |
135 |
#define S_IXUSR S_IEXEC |
136 |
#define S_ISDIR(val) (S_IFDIR & val) |
137 |
struct utimbuf |
138 |
{ |
139 |
time_t actime; |
140 |
time_t modtime; |
141 |
}; |
142 |
#endif |
143 |
|
144 |
#ifdef __DOS__ |
145 |
#include <pc.h> |
146 |
#include <io.h> |
147 |
#else |
148 |
#undef O_BINARY |
149 |
#define O_BINARY 0 |
150 |
#endif |
151 |
|
152 |
#ifdef __mac__ |
153 |
#define bool Boolean |
154 |
#endif |
155 |
|
156 |
#ifdef __riscos |
157 |
#define bool int |
158 |
#endif |
159 |
|
160 |
#ifdef WIN32 |
161 |
#include <windows.h> |
162 |
#include <direct.h> |
163 |
#if !defined(M_PI) |
164 |
#define M_PI 3.14159265358979323846 |
165 |
#endif |
166 |
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
167 |
#if _MSC_VER < 1100 |
168 |
#define bool char |
169 |
#endif |
170 |
#define LITTLE_ENDIAN_UNALIGNED 1 |
171 |
#endif |
172 |
|
173 |
/* If char has more then 8 bits, good night. */ |
174 |
#ifndef __BEOS__ |
175 |
typedef unsigned char uint8; |
176 |
typedef signed char int8; |
177 |
|
178 |
#if SIZEOF_SHORT == 2 |
179 |
typedef unsigned short uint16; |
180 |
typedef short int16; |
181 |
#elif SIZEOF_INT == 2 |
182 |
typedef unsigned int uint16; |
183 |
typedef int int16; |
184 |
#else |
185 |
#error No 2 byte type, you lose. |
186 |
#endif |
187 |
|
188 |
#if SIZEOF_INT == 4 |
189 |
typedef unsigned int uint32; |
190 |
typedef int int32; |
191 |
#elif SIZEOF_LONG == 4 |
192 |
typedef unsigned long uint32; |
193 |
typedef long int32; |
194 |
#else |
195 |
#error No 4 byte type, you lose. |
196 |
#endif |
197 |
#endif // __BEOS__ |
198 |
|
199 |
#define UNUSED(x) (x = x) |
200 |
} |