ReactOS 0.4.15-dev-8076-g06e89b2
mconfig.h
Go to the documentation of this file.
1/* @(#)mconfig.h 1.71 15/08/14 Copyright 1995-2015 J. Schilling */
2/*
3 * definitions for machine configuration
4 *
5 * Copyright (c) 1995-2015 J. Schilling
6 *
7 * This file must be included before any other file.
8 * If this file is not included before stdio.h you will not be
9 * able to get LARGEFILE support
10 *
11 * Use only cpp instructions.
12 *
13 * NOTE: SING: (Schily Is Not Gnu)
14 */
15/*
16 * The contents of this file are subject to the terms of the
17 * Common Development and Distribution License, Version 1.0 only
18 * (the "License"). You may not use this file except in compliance
19 * with the License.
20 *
21 * See the file CDDL.Schily.txt in this distribution for details.
22 * A copy of the CDDL is also available via the Internet at
23 * http://www.opensource.org/licenses/cddl1.txt
24 *
25 * When distributing Covered Code, include this CDDL HEADER in each
26 * file and include the License file CDDL.Schily.txt from this distribution.
27 */
28
29#ifndef _SCHILY_MCONFIG_H
30#define _SCHILY_MCONFIG_H
31
32/*
33 * Tell our users that this is a Schily SING compile environment.
34 */
35#define IS_SCHILY
36
37/*
38 * We need to do this before we include xconfig.h
39 */
40#ifdef NO_LARGEFILES
41#undef USE_LARGEFILES
42#endif
43#ifdef NO_ACL
44#undef USE_ACL
45#endif
46
47/*
48 * Inside <schily/archdefs.h> we get architecture specific Processor defines
49 * fetched from compiler predefinitions only.
50 */
51#include <schily/archdefs.h>
52
53/*
54 * Inside <schily/xconfig.h> we decide whether to use static or dynamic
55 * autoconf stuff.
56 */
57#include <schily/xconfig.h>
58
59/*
60 * Make sure that neither HAVE_LARGEFILES nor USE_LARGEFILES is defined
61 * if the platform does not support large files.
62 */
63#ifndef HAVE_LARGEFILES
64#undef USE_LARGEFILES
65#endif
66
67#ifdef __cplusplus
68extern "C" {
69#endif
70
71/*
72 * The NetBSD people want to bother us.
73 * They removed the definition for 'unix' and are bleating for every test
74 * for #if defined(unix). So we need to check for NetBSD early.
75 */
76#ifndef IS_UNIX
77# if defined(__NetBSD__)
78# define IS_UNIX
79# endif
80#endif
81
82#ifndef IS_UNIX
83# if (defined(unix) || defined(__unix) || defined(__unix__)) && \
84 !defined(__DJGPP__)
85# define IS_UNIX
86# endif
87#endif
88
89#ifdef __MSDOS__
90# define IS_MSDOS
91#endif
92
93#if defined(tos) || defined(__tos)
94# define IS_TOS
95#endif
96
97#ifdef THINK_C
98# define IS_MAC
99#endif
100
101#if defined(sun) || defined(__sun) || defined(__sun__)
102# define IS_SUN
103#endif
104
105#if defined(__CYGWIN32__) || defined(__CYGWIN__)
106# define IS_GCC_WIN32
107# define IS_CYGWIN
108
109#if defined(unix) || defined(_X86)
110# define IS_CYGWIN_1
111#endif
112#endif
113
114/* ------------------------------------------------------------------------- */
115/*
116 * Some magic that cannot (yet) be figured out with autoconf.
117 */
118
119#if defined(sun3) || defined(mc68000) || defined(mc68020)
120# ifndef HAVE_SCANSTACK
121# define HAVE_SCANSTACK
122# endif
123#endif
124#ifdef sparc
125# ifndef HAVE_LDSTUB
126# define HAVE_LDSTUB
127# endif
128# ifndef HAVE_SCANSTACK
129# define HAVE_SCANSTACK
130# endif
131#endif
132#if defined(__i386_) || defined(i386)
133# ifndef HAVE_XCHG
134# define HAVE_XCHG
135# endif
136# ifndef HAVE_SCANSTACK
137# define HAVE_SCANSTACK
138# endif
139#endif
140
141/*
142 * Use of SCANSTACK is disabled by default
143 */
144#ifndef USE_SCANSTACK
145# undef HAVE_SCANSTACK
146#else
147/*
148 * But ....
149 * The tests are much better now, so always give it a chance.
150 */
151#ifndef HAVE_SCANSTACK
152# define HAVE_SCANSTACK
153#endif
154#endif
155
156/*
157 * Allow to overwrite the defines in the makefiles by calling
158 *
159 * make COPTX=-DFORCE_SCANSTACK
160 */
161#ifdef FORCE_SCANSTACK
162# undef NO_SCANSTACK
163#ifndef HAVE_SCANSTACK
164# define HAVE_SCANSTACK
165#endif
166#ifndef USE_SCANSTACK
167# define USE_SCANSTACK
168#endif
169#endif
170
171/*
172 * This is the global switch to deactivate stack scanning
173 */
174#ifdef NO_SCANSTACK
175# ifdef HAVE_SCANSTACK
176# undef HAVE_SCANSTACK
177# endif
178#endif
179
180/*
181 * This is the global switch to deactivate using #pragma weak
182 */
183#ifdef NO_PRAGMA_WEAK
184# ifdef HAVE_PRAGMA_WEAK
185# undef HAVE_PRAGMA_WEAK
186# endif
187#endif
188
189#ifdef NO_FORK
190# ifdef HAVE_FORK
191# undef HAVE_FORK
192# endif
193# ifdef HAVE_VFORK
194# undef HAVE_VFORK
195# endif
196#endif
197#ifdef NO_VFORK
198# ifdef HAVE_VFORK
199# undef HAVE_VFORK
200# endif
201#endif
202
203#if defined(SOL2) || defined(SOL2) || \
204 defined(S5R4) || defined(__S5R4) || defined(SVR4)
205# ifndef __SVR4
206# define __SVR4
207# endif
208#endif
209
210#ifdef __SVR4
211# ifndef SVR4
212# define SVR4
213# endif
214#endif
215
216/*
217 * SunOS 4.x / SunOS 5.x
218 */
219#if defined(IS_SUN)
220# define HAVE_GETAV0
221#endif
222
223/*
224 * AIX
225 */
226#if defined(_IBMR2) || defined(_AIX)
227# ifndef IS_UNIX
228# define IS_UNIX /* ??? really ??? */
229# endif
230#endif
231
232/*
233 * QNX
234 */
235#if defined(__QNX__)
236# ifndef IS_UNIX
237# define IS_UNIX
238# endif
239#endif
240
241/*
242 * Silicon Graphics (must be before SVR4)
243 */
244#if defined(sgi) || defined(__sgi)
245# define __NOT_SVR4__ /* Not a real SVR4 implementation */
246#endif
247
248/*
249 * Data General
250 */
251#if defined(__DGUX__)
252#ifdef XXXXXXX
253# undef HAVE_MTGET_DSREG
254# undef HAVE_MTGET_RESID
255# undef HAVE_MTGET_FILENO
256# undef HAVE_MTGET_BLKNO
257#endif
258# define mt_type mt_model
259# define mt_dsreg mt_status1
260# define mt_erreg mt_status2
261 /*
262 * DGUX hides its flock as dg_flock.
263 */
264# define HAVE_FLOCK
265# define flock dg_flock
266 /*
267 * Use the BSD style wait on DGUX to get the resource usages of child
268 * processes.
269 */
270# define _BSD_WAIT_FLAVOR
271#endif
272
273/*
274 * Apple Rhapsody (This is the name for Mac OS X beta)
275 */
276#if defined(__NeXT__) && defined(__TARGET_OSNAME) && __TARGET_OSNAME == rhapsody
277# define HAVE_OSDEF /* prevent later definitions to overwrite current */
278# ifndef IS_UNIX
279# define IS_UNIX
280# endif
281#endif
282
283/*
284 * NextStep
285 */
286#if defined(__NeXT__) && !defined(HAVE_OSDEF)
287#define NO_PRINT_OVR
288#undef HAVE_USG_STDIO
289 /*
290 * NeXT Step 3.x uses
291 * __flsbuf(unsigned char, FILE *)
292 * instead of __flsbuf(int, FILE *)
293 */
294# ifndef IS_UNIX
295# define IS_UNIX
296# endif
297#endif
298
299/*
300 * Mac OS X
301 */
302#if defined(__APPLE__) && defined(__MACH__)
303# ifndef IS_UNIX
304# define IS_UNIX
305# endif
306# define IS_MACOS_X
307#endif
308
309/*
310 * NextStep 3.x has a broken linker that does not allow us to override
311 * these functions.
312 */
313#ifndef __OPRINTF__
314
315#ifdef NO_PRINT_OVR
316# define printf Xprintf
317# define fprintf Xfprintf
318# define sprintf Xsprintf
319#endif
320
321#endif /* __OPRINTF__ */
322
323/* ------------------------------------------------------------------------- */
324
325#ifndef _SCHILY_PROTOTYP_H
326#include <schily/prototyp.h>
327#endif
328
329/*
330 * We use HAVE_LONGLONG as generalized test on whether "long long", "__in64" or
331 * something similar exist.
332 *
333 * In case that HAVE_LONGLONG is defined here, this is an indication that
334 * "long long" works. We define HAVE_LONG_LONG to keep this knowledge.
335 */
336#ifdef HAVE_LONGLONG
337# define HAVE_LONG_LONG
338#endif
339
340/*
341 * Microsoft C defines _MSC_VER
342 * use __int64 instead of long long and use 0i64 for a signed long long const
343 * and 0ui64 for an unsigned long long const.
344 *
345 * #if defined(HAVE___INT64)
346 * use __int64
347 * #elif defined(HAVE_LONGLONG)
348 * use long long
349 * #endif
350 *
351 * Be very careful here as older MSVC versions do not implement long long but
352 * rather __int64 and once someone makes 'long long' 128 bits on a 64 bit
353 * machine, we may need to check for a MSVC __int128 type.
354 */
355#ifndef HAVE_LONGLONG
356# if defined(HAVE___INT64)
357# define HAVE_LONGLONG
358# endif
359#endif
360
361/*
362 * gcc 2.x generally implements the "long long" type.
363 */
364#ifdef __GNUC__
365# if __GNUC__ > 1
366# ifndef HAVE_LONGLONG
367# define HAVE_LONGLONG
368# endif
369# ifndef HAVE_LONG_LONG
370# define HAVE_LONG_LONG
371# endif
372# endif
373#endif
374
375#ifdef __CHAR_UNSIGNED__ /* GNU GCC define (dynamic) */
376#ifndef CHAR_IS_UNSIGNED
377#define CHAR_IS_UNSIGNED /* Sing Schily define (static) */
378#endif
379#endif
380
381/*
382 * Convert to GNU name
383 */
384#ifdef HAVE_STDC_HEADERS
385# ifndef STDC_HEADERS
386# define STDC_HEADERS
387# endif
388#endif
389/*
390 * Convert to SCHILY name
391 */
392#ifdef STDC_HEADERS
393# ifndef HAVE_STDC_HEADERS
394# define HAVE_STDC_HEADERS
395# endif
396#endif
397
398#ifdef IS_UNIX
399# define HAVE_PATH_DELIM
400# define PATH_DELIM '/'
401# define PATH_DELIM_STR "/"
402# define PATH_ENV_DELIM ':'
403# define PATH_ENV_DELIM_STR ":"
404# define far
405# define near
406#endif
407
408/*
409 * Win32 with Gygwin
410 */
411#ifdef IS_GCC_WIN32
412# define HAVE_PATH_DELIM
413# define PATH_DELIM '/'
414# define PATH_DELIM_STR "/"
415# define PATH_ENV_DELIM ':'
416# define PATH_ENV_DELIM_STR ":"
417# define HAVE_DOS_DRIVELETTER
418# define far
419# define near
420# define NEED_O_BINARY
421#endif
422
423/*
424 * Win32 with Mingw32
425 */
426#ifdef __MINGW32__
427# define HAVE_PATH_DELIM
428# define PATH_DELIM '/'
429# define PATH_DELIM_STR "/"
430# define PATH_ENV_DELIM ';'
431# define PATH_ENV_DELIM_STR ";"
432# define HAVE_DOS_DRIVELETTER
433# define far
434# define near
435# define NEED_O_BINARY
436#endif
437
438/*
439 * OS/2 EMX
440 */
441#ifdef __EMX__ /* We don't want to call it UNIX */
442# define HAVE_PATH_DELIM
443# define PATH_DELIM '/'
444# define PATH_DELIM_STR "/"
445# define PATH_ENV_DELIM ';'
446# define PATH_ENV_DELIM_STR ";"
447# define HAVE_DOS_DRIVELETTER
448# define far
449# define near
450# define NEED_O_BINARY
451#endif
452
453#ifdef __BEOS__ /* We don't want to call it UNIX */
454# define HAVE_PATH_DELIM
455# define PATH_DELIM '/'
456# define PATH_DELIM_STR "/"
457# define PATH_ENV_DELIM ':'
458# define PATH_ENV_DELIM_STR ":"
459# define far
460# define near
461#endif
462
463/*
464 * DOS with DJGPP
465 */
466#ifdef __DJGPP__ /* We don't want to call it UNIX */
467# define HAVE_PATH_DELIM
468# define PATH_DELIM '/'
469# define PATH_DELIM_STR "/"
470# define PATH_ENV_DELIM ';'
471# define PATH_ENV_DELIM_STR ";"
472# define HAVE_DOS_DRIVELETTER
473
474# define NEED_O_BINARY
475#endif
476
477/*
478 * Vanilla DOS
479 */
480#if defined(IS_MSDOS) && !defined(__DJGPP__)
481# define HAVE_PATH_DELIM
482# define PATH_DELIM '\\'
483# define PATH_DELIM_STR "\\"
484# define PATH_ENV_DELIM ';'
485# define PATH_ENV_DELIM_STR ";"
486# define HAVE_DOS_DRIVELETTER
487
488# define NEED_O_BINARY
489#endif
490
491/*
492 * ATARI TOS
493 */
494#ifdef IS_TOS
495# define HAVE_PATH_DELIM
496# define PATH_DELIM '\\'
497# define PATH_DELIM_STR "\\"
498# define PATH_ENV_DELIM ','
499# define PATH_ENV_DELIM_STR ","
500# define HAVE_DOS_DRIVELETTER
501# define far
502# define near
503#endif
504
505/*
506 * Mac OS 9
507 */
508#ifdef IS_MAC
509# define HAVE_PATH_DELIM
510# define PATH_DELIM ':'
511# define PATH_DELIM_STR ":"
512# define PATH_ENV_DELIM ';' /* ??? */
513# define PATH_ENV_DELIM_STR ";" /* ??? */
514# define far
515# define near
516#endif
517
518/*
519 * I hope this will make compilation on unknown OS easier.
520 */
521#ifndef HAVE_PATH_DELIM /* Default to POSIX rules */
522# define HAVE_PATH_DELIM
523# define PATH_DELIM '/'
524# define PATH_DELIM_STR "/"
525# define PATH_ENV_DELIM ':'
526# define PATH_ENV_DELIM_STR ":"
527# define far
528# define near
529#endif
530
531/*
532 * Is there a solution for /dev/tty and similar?
533 */
534#ifdef HAVE__DEV_NULL
535# define DEV_NULL "/dev/null"
536#else
537#if defined(_MSC_VER) || defined(__MINGW32__)
538# define DEV_NULL "NUL"
539#else
540/*
541 * What to do here?
542 */
543#endif
544#endif
545
546#ifdef DBG_MALLOC
547/*
548 * We need to include this here already in order to make sure that
549 * every program that is based on mconfig.h will include schily/dbgmalloc.h
550 * in case that we specify -DDBG_MALLOC
551 */
552#include <schily/dbgmalloc.h>
553#endif
554
555#ifdef __cplusplus
556}
557#endif
558
559#endif /* _SCHILY_MCONFIG_H */