summaryrefslogtreecommitdiff
path: root/include/wolf/port/sys.h
blob: c5ff517f07d31683ad6f2cc3bda17f1819663424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
/*
    Copyright (C) 2008 Andreas Baumann <abaumann@yahoo.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef WOLF_SYS_H
#define WOLF_SYS_H

/**
 * @addtogroup wolf_port Porting
 * @{
 */

/**
 * @file sys.h
 * @brief main port file with constants and flags per platform
 * @author Andreas Baumann <abaumann@yahoo.com>
 */

#if defined LINUX
#if OS_MAJOR_VERSION == 2
#if OS_MINOR_VERSION == 6
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_STRCASECMP
#define HAVE_STRNCASECMP
#define HAVE_STRINGS_H
#define HAVE_SYSLOG_H
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* defined OS_MINOR_VERSION == 6 */
#else
#if OS_MAJOR_VERSION == 3
#if OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <= 9
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_STRCASECMP
#define HAVE_STRNCASECMP
#define HAVE_STRINGS_H
#define HAVE_SYSLOG_H
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* define OS_MINOR_VERSION == 0 */
#else
	#error unknown platform
#endif /* defined OS_MAJOR_VERSION == 3 */
#endif /* defined OS_MAJOR_VERSION == 2 */
#endif /* defined LINUX */

#if defined FREEBSD
#if OS_MAJOR_VERSION == 8
#if OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <=2
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_SYSLOG_H
#define HAVE_STRLCPY
#define MUST_DEFINE_STRLCPY_PROTOTYPE
#define HAVE_STRLCAT
#define MUST_DEFINE_STRLCAT_PROTOTYPE
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* defined OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <=2 */
#else
#if OS_MAJOR_VERSION == 7
#if OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <= 2
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_SYSLOG_H
#define HAVE_STRLCPY
#define MUST_DEFINE_STRLCPY_PROTOTYPE
#define HAVE_STRLCAT
#define MUST_DEFINE_STRLCAT_PROTOTYPE
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* defined OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <= 2 */
#else
#if OS_MAJOR_VERSION == 6
#if OS_MINOR_VERSION == 2
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_SYSLOG_H
#define HAVE_STRLCPY
#define MUST_DEFINE_STRLCPY_PROTOTYPE
#define HAVE_STRLCAT
#define MUST_DEFINE_STRLCAT_PROTOTYPE
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* defined OS_MINOR_VERSION == 2 */
#else
	#error unknown platform
#endif /* defined OS_MAJOR_VERSION == 6 */
#endif /* defined OS_MAJOR_VERSION == 7 */
#endif /* defined OS_MAJOR_VERSION == 8 */
#endif /* defined FREEBSD */

#if defined OPENBSD
#if OS_MAJOR_VERSION == 4
#if OS_MINOR_VERSION >= 2 && OS_MINOR_VERSION <= 9
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_SYSLOG_H
#define HAVE_STRLCPY
#define MUST_DEFINE_STRLCPY_PROTOTYPE
#define HAVE_STRLCAT
#define MUST_DEFINE_STRLCAT_PROTOTYPE
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* OS_MINOR_VERSION >= 2 && OS_MINOR_VERSION <= 9 */
#else
#if OS_MAJOR_VERSION == 5
#else 
	#error unknown platform
#endif /* OS_MAJOR_VERSION == 5 */
#if OS_MINOR_VERSION == 0
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_SYSLOG_H
#define HAVE_STRLCPY
#define MUST_DEFINE_STRLCPY_PROTOTYPE
#define HAVE_STRLCAT
#define MUST_DEFINE_STRLCAT_PROTOTYPE
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#endif /* OS_MINOR_VERSION == 0 */
#endif /* OS_MAJOR_VERSION == 4 */
#endif /* defined OPENBSD */

#if defined NETBSD
#if OS_MAJOR_VERSION == 5
#if OS_MINOR_VERSION == 0
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_STRCASECMP
#define HAVE_STRNCASECMP
#define HAVE_STRINGS_H
#define HAVE_SYSLOG_H
#define GETTEXT_NEEDS_FORMAT_ARG
#define HAVE_STRLCPY
#define MUST_DEFINE_STRLCPY_PROTOTYPE
#define HAVE_STRLCAT
#define MUST_DEFINE_STRLCAT_PROTOTYPE
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* defined OS_MINOR_VERSION == 2 */
#else /* defined OS_MAJOR_VERSION == 4 */

#if OS_MAJOR_VERSION == 4
#if OS_MINOR_VERSION == 0
#define _XOPEN_SOURCE 600
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_VSNPRINTF
#define HAVE_SNPRINTF
#define HAVE_VASPRINTF
#define HAVE_ASPRINTF
#define HAVE_STRDUP
#define HAVE_STRERROR_R
#define HAVE_STRCASECMP
#define HAVE_STRNCASECMP
#define HAVE_STRINGS_H
#define HAVE_SYSLOG_H
#define GETTEXT_NEEDS_FORMAT_ARG
#define HAVE_STRLCPY
#define MUST_DEFINE_STRLCPY_PROTOTYPE
#define HAVE_STRLCAT
#define MUST_DEFINE_STRLCAT_PROTOTYPE
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* defined OS_MINOR_VERSION == 2 */
#else
	#error unknown platform
#endif /* defined OS_MAJOR_VERSION == 4 */
#endif /* defined OS_MAJOR_VERSION == 5 */
#endif /* defined NETBSD */

#if defined SUNOS
#if OS_MAJOR_VERSION == 5
#if OS_MINOR_VERSION == 8
#if !defined __cplusplus
#define _XOPEN_SOURCE 600
#define __EXTENSIONS__
#endif
/* Solaris 8 has a snprintf, but it doesn't work for all C99 features,
 * e.g. %zd for size_t */
#define HAVE_STRDUP
#define HAVE_ENUM_BOOL
#define HAVE_STRCASECMP 
#define HAVE_STRNCASECMP
#define HAVE_STRINGS_H
#define HAVE_SYSLOG_H
#define GETTEXT_NEEDS_FORMAT_ARG
#define HAVE_STRLCPY
#define HAVE_STRLCAT
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
#if OS_MINOR_VERSION == 10
#if !defined __cplusplus 
#define _XOPEN_SOURCE 600
#define __EXTENSIONS__
#endif
#define HAVE_SNPRINTF
#define HAVE_VSNPRINTF
#define HAVE_STRDUP
#define HAVE_STDBOOL_H
#define HAVE_STDINT_H
#define HAVE_STRERROR_R
#define HAVE_STRCASECMP
#define HAVE_STRNCASECMP
#define HAVE_STRINGS_H
#define HAVE_SYSLOG_H
#define HAVE_STRLCPY
#define HAVE_STRLCAT
#define HAVE_GETADDRINFO
#define HAVE_IPV6
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* OS_MINOR_VERSION == 10 */
#endif /* OS_MINOR_VERSION == 8 */
#else
	#error unknown platform
#endif /* OS_MAJOR_VERSION == 5 */
#endif /* defined SUNOS */

#if defined CYGWIN
#if OS_MAJOR_VERSION == 5
#if OS_MINOR_VERSION == 0
#define _XOPEN_SOURCE 600
#define HAVE_ENUM_BOOL
#define HAVE_SYSLOG_H
#define HAVE_PTHREADS
#else
	#error unknown platform
#endif /* OS_MINOR_VERSION == 0 */
#else
	#error unknown platform
#endif /* OS_MAJOR_VERSION == 5 */
#endif /* defined CYGWIN */

#if defined _WIN32
#define HAVE_ITOA
#define HAVE_EVENTLOG
#define HAVE_GETADDRINFO
#endif /* defined _WIN32 */

/* special hacks for Microsoft Windows compilers */

#if defined _MSC_VER
#endif /* defined _MSC_VER */

/* define INLINE (C99 inlining attribute is not yet known by all compilers */
#if defined _MSC_VER
#define INLINE __inline
#else
#define INLINE inline
#endif

/* special hacks for GCC compilers */

/* define one version string for comparing GNU c versions */
#if defined __GNUC__
#if defined __GNUC_PATCHLEVEL__
#define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#else
#define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 )
#endif
#endif

/* special hacks for Intel compiler */

#if defined __INTEL_COMPILER

#if( __INTEL_COMPILER >= 1100 )

/* remark #981: operands are evaluated in unspecified orde, just annoying, code
 * gets completly funny, if we try to avoid this remark!
 */
#pragma warning(disable:981)

#endif /*  __INTEL_COMPILER >= 1100 */

#endif /* defined __INTEL_COMPILER */

/** @} */ /* @addtogroup wolf_port */

/* special hacks for the Portable C compiler */

#if defined __PCC__

/* __PRETTY_FUNCTION__ is a GNU extension, no harm if we define it to _func_
 * which must be there (poluted pthreads.h header file!) 
 */
#define __PRETTY_FUNCTION__ __func__
#define _VA_LIST_DEFINED

#define __const const
#define __USER_LABEL_PREFIX__

/* all GNUish macros should be ignored */
#define __attribute__(X)

#endif /* defined __PCC__ **/

#endif /* ifndef WOLF_SYS_H */