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-2004 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 |
#include <stdio.h> |
25 |
#include <stdlib.h> |
26 |
#include <assert.h> |
27 |
#include <ctype.h> |
28 |
#include <errno.h> |
29 |
#include <signal.h> |
30 |
|
31 |
#include <vector> |
32 |
using std::vector; |
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 __NeXT__ |
121 |
#define S_IRUSR S_IREAD |
122 |
#define S_IWUSR S_IWRITE |
123 |
#define S_IXUSR S_IEXEC |
124 |
#define S_ISDIR(val) (S_IFDIR & val) |
125 |
struct utimbuf |
126 |
{ |
127 |
time_t actime; |
128 |
time_t modtime; |
129 |
}; |
130 |
#endif |
131 |
|
132 |
#ifdef __DOS__ |
133 |
#include <pc.h> |
134 |
#include <io.h> |
135 |
#else |
136 |
#undef O_BINARY |
137 |
#define O_BINARY 0 |
138 |
#endif |
139 |
|
140 |
#ifdef __mac__ |
141 |
#define bool Boolean |
142 |
#endif |
143 |
|
144 |
#ifdef __riscos |
145 |
#define bool int |
146 |
#endif |
147 |
|
148 |
#ifdef WIN32 |
149 |
#include <windows.h> |
150 |
#include <direct.h> |
151 |
#if !defined(M_PI) |
152 |
#define M_PI 3.14159265358979323846 |
153 |
#endif |
154 |
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
155 |
#if _MSC_VER < 1100 |
156 |
#define bool char |
157 |
#endif |
158 |
#define LITTLE_ENDIAN_UNALIGNED 1 |
159 |
#endif |
160 |
|
161 |
/* If char has more then 8 bits, good night. */ |
162 |
#ifndef __BEOS__ |
163 |
typedef unsigned char uint8; |
164 |
typedef signed char int8; |
165 |
|
166 |
#if SIZEOF_SHORT == 2 |
167 |
typedef unsigned short uint16; |
168 |
typedef short int16; |
169 |
#elif SIZEOF_INT == 2 |
170 |
typedef unsigned int uint16; |
171 |
typedef int int16; |
172 |
#else |
173 |
#error No 2 byte type, you lose. |
174 |
#endif |
175 |
|
176 |
#if SIZEOF_INT == 4 |
177 |
typedef unsigned int uint32; |
178 |
typedef int int32; |
179 |
#elif SIZEOF_LONG == 4 |
180 |
typedef unsigned long uint32; |
181 |
typedef long int32; |
182 |
#else |
183 |
#error No 4 byte type, you lose. |
184 |
#endif |
185 |
|
186 |
#else |
187 |
#include <support/SupportDefs.h> |
188 |
#endif // __BEOS__ |