1 /*
2  * arch_def.h
3  * platform specific definitions
4  * - standalone header
5  * - doesn't and must not include any other headers
6  * - shouldn't depend on compiler.h, q_stdinc.h, or
7  *   any other headers
8  *
9  * $Id: arch_def.h 5778 2016-12-27 14:47:16Z sezero $
10  *
11  * Copyright (C) 2007-2016  O.Sezer <sezero@users.sourceforge.net>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or (at
16  * your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21  *
22  * See the GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, write to the Free Software Foundation, Inc.,
26  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27  */
28 
29 #ifndef ARCHDEFS_H
30 #define ARCHDEFS_H
31 
32 
33 #if defined(__DJGPP__) || defined(__MSDOS__) || defined(__DOS__) || defined(_MSDOS)
34 
35 #   if !defined(PLATFORM_DOS)
36 #	define	PLATFORM_DOS		1
37 #   endif
38 
39 #elif defined(__OS2__) || defined(__EMX__)
40 
41 #   if !defined(PLATFORM_OS2)
42 #	define	PLATFORM_OS2		1
43 #   endif
44 
45 #elif defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(__NT__) || defined(_Windows)
46 
47 #   if !defined(PLATFORM_WINDOWS)
48 #	define	PLATFORM_WINDOWS	1
49 #   endif
50 
51 #elif defined(__APPLE__) && defined(__MACH__)		/* Mac OS X */
52 
53 #   if !defined(PLATFORM_OSX)
54 #	define	PLATFORM_OSX		1
55 #   endif
56 
57 #elif defined(macintosh)			/* Mac OS classic */
58 
59 #   if !defined(PLATFORM_MAC)
60 #	define	PLATFORM_MAC		1
61 #   endif
62 
63 #elif defined(__MORPHOS__) || defined(__AROS__) || defined(AMIGAOS)	|| \
64       defined(__amigaos__) || defined(__amigaos4__) ||defined(__amigados__) || \
65       defined(AMIGA) || defined(_AMIGA) || defined(__AMIGA__)
66 
67 #   if !defined(PLATFORM_AMIGA)
68 #	define	PLATFORM_AMIGA		1
69 #   endif
70 
71 #elif defined(__riscos__)
72 
73 #   if !defined(PLATFORM_RISCOS)
74 #	define	PLATFORM_RISCOS		1
75 #   endif
76 
77 #else	/* here goes the unix platforms */
78 
79 #if defined(__unix) || defined(__unix__) || defined(unix)	|| \
80     defined(__linux__) || defined(__linux)			|| \
81     defined(__FreeBSD__) || defined(__DragonFly__)		|| \
82     defined(__FreeBSD_kernel__) /* Debian GNU/kFreeBSD */	|| \
83     defined(__OpenBSD__) || defined(__NetBSD__)			|| \
84     defined(__hpux) || defined(__hpux__) || defined(_hpux)	|| \
85     defined(__sun) || defined(sun)				|| \
86     defined(__sgi) || defined(sgi) || defined(__sgi__)		|| \
87     defined(__GNU__) /* GNU/Hurd */				|| \
88     defined(__QNX__) || defined(__QNXNTO__)
89 #   if !defined(PLATFORM_UNIX)
90 #	define	PLATFORM_UNIX		1
91 #   endif
92 #endif
93 
94 #endif	/* PLATFORM_xxx */
95 
96 
97 #if defined (PLATFORM_OSX)		/* OS X is unix-based */
98 #   if !defined(PLATFORM_UNIX)
99 #	define	PLATFORM_UNIX		2
100 #   endif
101 #endif	/* OS X -> PLATFORM_UNIX */
102 
103 
104 #if defined(__FreeBSD__) || defined(__DragonFly__)		|| \
105     defined(__FreeBSD_kernel__) /* Debian GNU/kFreeBSD */	|| \
106     defined(__OpenBSD__) || defined(__NetBSD__)
107 #   if !defined(PLATFORM_BSD)
108 #	define	PLATFORM_BSD		1
109 #   endif
110 #endif	/* PLATFORM_BSD (for convenience) */
111 
112 
113 #if defined(PLATFORM_AMIGA) && !defined(PLATFORM_AMIGAOS3)
114 #   if !defined(__MORPHOS__) && !defined(__AROS__) && !defined(__amigaos4__)
115 #	define	PLATFORM_AMIGAOS3	1
116 #   endif
117 #endif	/* PLATFORM_AMIGAOS3 (for convenience) */
118 
119 
120 #if defined(_WIN64)
121 #	define	PLATFORM_STRING	"Win64"
122 #elif defined(PLATFORM_WINDOWS)
123 #	define	PLATFORM_STRING	"Windows"
124 #elif defined(PLATFORM_DOS)
125 #	define	PLATFORM_STRING	"DOS"
126 #elif defined(PLATFORM_OS2)
127 #	define	PLATFORM_STRING	"OS/2"
128 #elif defined(__linux__) || defined(__linux)
129 #	define	PLATFORM_STRING	"Linux"
130 #elif defined(__DragonFly__)
131 #	define	PLATFORM_STRING "DragonFly"
132 #elif defined(__FreeBSD__)
133 #	define	PLATFORM_STRING	"FreeBSD"
134 #elif defined(__NetBSD__)
135 #	define	PLATFORM_STRING	"NetBSD"
136 #elif defined(__OpenBSD__)
137 #	define	PLATFORM_STRING	"OpenBSD"
138 #elif defined(__MORPHOS__)
139 #	define	PLATFORM_STRING	"MorphOS"
140 #elif defined(__AROS__)
141 #	define	PLATFORM_STRING	"AROS"
142 #elif defined(__amigaos4__)
143 #	define	PLATFORM_STRING	"AmigaOS4"
144 #elif defined(PLATFORM_AMIGA)
145 #	define	PLATFORM_STRING	"AmigaOS"
146 #elif defined(__QNX__) || defined(__QNXNTO__)
147 #	define	PLATFORM_STRING	"QNX"
148 #elif defined(PLATFORM_OSX)
149 #	define	PLATFORM_STRING	"MacOSX"
150 #elif defined(PLATFORM_MAC)
151 #	define	PLATFORM_STRING	"MacOS"
152 #elif defined(__hpux) || defined(__hpux__) || defined(_hpux)
153 #	define	PLATFORM_STRING	"HP-UX"
154 #elif (defined(__sun) || defined(sun)) && (defined(__svr4__) || defined(__SVR4))
155 #	define	PLATFORM_STRING	"Solaris"
156 #elif defined(__sun) || defined(sun)
157 #	define	PLATFORM_STRING	"SunOS"
158 #elif defined(__sgi) || defined(sgi) || defined(__sgi__)
159 #	define	PLATFORM_STRING	"Irix"
160 #elif defined(PLATFORM_RISCOS)
161 #	define	PLATFORM_STRING	"RiscOS"
162 #elif defined(__GNU__)
163 #	define	PLATFORM_STRING	"GNU/Hurd"
164 #elif defined(PLATFORM_UNIX)
165 #	define	PLATFORM_STRING	"Unix"
166 #else
167 #	define	PLATFORM_STRING	"Unknown"
168 #	warning "Platform is UNKNOWN."
169 #endif	/* PLATFORM_STRING */
170 
171 #endif  /* ARCHDEFS_H */
172 
173