1 |
cebix |
1.1 |
/* |
2 |
|
|
* sysdeps.h - Try to include the right system headers and get other |
3 |
|
|
* system-specific stuff right |
4 |
|
|
* |
5 |
cebix |
1.3 |
* Frodo (C) 1994-1997,2002-2003 Christian Bauer |
6 |
cebix |
1.1 |
* |
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 |
|
|
#include <errno.h> |
32 |
|
|
#include <signal.h> |
33 |
|
|
|
34 |
|
|
#ifdef HAVE_SYS_TYPES_H |
35 |
|
|
#include <sys/types.h> |
36 |
|
|
#endif |
37 |
|
|
|
38 |
|
|
#ifdef HAVE_VALUES_H |
39 |
|
|
#include <values.h> |
40 |
|
|
#endif |
41 |
|
|
|
42 |
|
|
#ifdef HAVE_STRINGS_H |
43 |
|
|
#include <strings.h> |
44 |
|
|
#endif |
45 |
|
|
#ifdef HAVE_STRING_H |
46 |
|
|
#include <string.h> |
47 |
|
|
#endif |
48 |
|
|
|
49 |
|
|
#ifdef HAVE_UNISTD_H |
50 |
|
|
#include <unistd.h> |
51 |
|
|
#endif |
52 |
|
|
#ifdef HAVE_FCNTL_H |
53 |
|
|
#include <fcntl.h> |
54 |
|
|
#endif |
55 |
|
|
|
56 |
|
|
#ifdef HAVE_UTIME_H |
57 |
|
|
#include <utime.h> |
58 |
|
|
#endif |
59 |
|
|
|
60 |
|
|
#ifdef HAVE_SYS_PARAM_H |
61 |
|
|
#include <sys/param.h> |
62 |
|
|
#endif |
63 |
|
|
|
64 |
|
|
#ifdef HAVE_SYS_SELECT_H |
65 |
|
|
#include <sys/select.h> |
66 |
|
|
#endif |
67 |
|
|
|
68 |
|
|
#ifdef HAVE_SYS_VFS_H |
69 |
|
|
#include <sys/vfs.h> |
70 |
|
|
#endif |
71 |
|
|
|
72 |
|
|
#ifdef HAVE_SYS_STAT_H |
73 |
|
|
#include <sys/stat.h> |
74 |
|
|
#endif |
75 |
|
|
|
76 |
|
|
#ifdef HAVE_SYS_MOUNT_H |
77 |
|
|
#include <sys/mount.h> |
78 |
|
|
#endif |
79 |
|
|
|
80 |
|
|
#ifdef HAVE_SYS_STATFS_H |
81 |
|
|
#include <sys/statfs.h> |
82 |
|
|
#endif |
83 |
|
|
|
84 |
|
|
#ifdef HAVE_SYS_STATVFS_H |
85 |
|
|
#include <sys/statvfs.h> |
86 |
|
|
#endif |
87 |
|
|
|
88 |
|
|
#if TIME_WITH_SYS_TIME |
89 |
|
|
# include <sys/time.h> |
90 |
|
|
# include <time.h> |
91 |
|
|
#else |
92 |
|
|
# if HAVE_SYS_TIME_H |
93 |
|
|
# include <sys/time.h> |
94 |
|
|
# else |
95 |
|
|
# include <time.h> |
96 |
|
|
# endif |
97 |
|
|
#endif |
98 |
|
|
|
99 |
|
|
#if HAVE_DIRENT_H |
100 |
|
|
# include <dirent.h> |
101 |
|
|
#else |
102 |
|
|
# define dirent direct |
103 |
|
|
# if HAVE_SYS_NDIR_H |
104 |
|
|
# include <sys/ndir.h> |
105 |
|
|
# endif |
106 |
|
|
# if HAVE_SYS_DIR_H |
107 |
|
|
# include <sys/dir.h> |
108 |
|
|
# endif |
109 |
|
|
# if HAVE_NDIR_H |
110 |
|
|
# include <ndir.h> |
111 |
|
|
# endif |
112 |
|
|
#endif |
113 |
|
|
|
114 |
|
|
#include <assert.h> |
115 |
|
|
|
116 |
|
|
#if EEXIST == ENOTEMPTY |
117 |
|
|
#define BROKEN_OS_PROBABLY_AIX |
118 |
|
|
#endif |
119 |
|
|
|
120 |
|
|
#ifdef HAVE_LINUX_JOYSTICK_H |
121 |
|
|
#include <linux/joystick.h> |
122 |
|
|
#endif |
123 |
|
|
|
124 |
|
|
#ifdef __NeXT__ |
125 |
|
|
#define S_IRUSR S_IREAD |
126 |
|
|
#define S_IWUSR S_IWRITE |
127 |
|
|
#define S_IXUSR S_IEXEC |
128 |
|
|
#define S_ISDIR(val) (S_IFDIR & val) |
129 |
|
|
struct utimbuf |
130 |
|
|
{ |
131 |
|
|
time_t actime; |
132 |
|
|
time_t modtime; |
133 |
|
|
}; |
134 |
|
|
#endif |
135 |
|
|
|
136 |
|
|
#ifdef __DOS__ |
137 |
|
|
#include <pc.h> |
138 |
|
|
#include <io.h> |
139 |
|
|
#else |
140 |
|
|
#undef O_BINARY |
141 |
|
|
#define O_BINARY 0 |
142 |
|
|
#endif |
143 |
|
|
|
144 |
|
|
#ifdef __mac__ |
145 |
|
|
#define bool Boolean |
146 |
|
|
#endif |
147 |
|
|
|
148 |
|
|
#ifdef __riscos |
149 |
|
|
#define bool int |
150 |
|
|
#endif |
151 |
|
|
|
152 |
|
|
#ifdef WIN32 |
153 |
|
|
#include <windows.h> |
154 |
|
|
#include <direct.h> |
155 |
|
|
#if !defined(M_PI) |
156 |
|
|
#define M_PI 3.14159265358979323846 |
157 |
|
|
#endif |
158 |
|
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
159 |
|
|
#if _MSC_VER < 1100 |
160 |
|
|
#define bool char |
161 |
|
|
#endif |
162 |
|
|
#define LITTLE_ENDIAN_UNALIGNED 1 |
163 |
|
|
#endif |
164 |
|
|
|
165 |
|
|
/* If char has more then 8 bits, good night. */ |
166 |
|
|
#ifndef __BEOS__ |
167 |
|
|
typedef unsigned char uint8; |
168 |
|
|
typedef signed char int8; |
169 |
|
|
|
170 |
|
|
#if SIZEOF_SHORT == 2 |
171 |
|
|
typedef unsigned short uint16; |
172 |
|
|
typedef short int16; |
173 |
|
|
#elif SIZEOF_INT == 2 |
174 |
|
|
typedef unsigned int uint16; |
175 |
|
|
typedef int int16; |
176 |
|
|
#else |
177 |
|
|
#error No 2 byte type, you lose. |
178 |
|
|
#endif |
179 |
|
|
|
180 |
|
|
#if SIZEOF_INT == 4 |
181 |
|
|
typedef unsigned int uint32; |
182 |
|
|
typedef int int32; |
183 |
|
|
#elif SIZEOF_LONG == 4 |
184 |
|
|
typedef unsigned long uint32; |
185 |
|
|
typedef long int32; |
186 |
|
|
#else |
187 |
|
|
#error No 4 byte type, you lose. |
188 |
|
|
#endif |
189 |
cebix |
1.5 |
|
190 |
|
|
#else |
191 |
cebix |
1.4 |
#include <support/SupportDefs.h> |
192 |
cebix |
1.1 |
#endif // __BEOS__ |
193 |
|
|
|
194 |
|
|
} |