1 /*****************************************************************
3 | Neptune - Configuration
5 | Copyright (c) 2002-2008, Axiomatic Systems, LLC.
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 | * Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 | * Neither the name of Axiomatic Systems nor the
16 | names of its contributors may be used to endorse or promote products
17 | derived from this software without specific prior written permission.
19 | THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 ****************************************************************/
32 #ifndef _NPT_CONFIG_H_
33 #define _NPT_CONFIG_H_
35 /*----------------------------------------------------------------------
37 +---------------------------------------------------------------------*/
38 #define NPT_CONFIG_HAVE_ASSERT_H
39 #define NPT_CONFIG_HAVE_STD_C
40 #define NPT_CONFIG_HAVE_POSIX_TIME
41 #define NPT_CONFIG_HAVE_ASSERT_H
42 #define NPT_CONFIG_HAVE_STDLIB_H
43 #define NPT_CONFIG_HAVE_STDIO_H
44 #define NPT_CONFIG_HAVE_STDARG_H
45 #define NPT_CONFIG_HAVE_STDINT_H
46 #define NPT_CONFIG_HAVE_STRING_H
47 #define NPT_CONFIG_HAVE_LIMITS_H
49 /*----------------------------------------------------------------------
51 +---------------------------------------------------------------------*/
52 #if defined(NPT_CONFIG_HAVE_STD_C)
53 #define NPT_CONFIG_HAVE_MALLOC
54 #define NPT_CONFIG_HAVE_CALLOC
55 #define NPT_CONFIG_HAVE_REALLOC
56 #define NPT_CONFIG_HAVE_FREE
57 #define NPT_CONFIG_HAVE_MEMCPY
58 #define NPT_CONFIG_HAVE_MEMSET
59 #define NPT_CONFIG_HAVE_MEMCMP
60 #define NPT_CONFIG_HAVE_GETENV
61 #define NPT_CONFIG_HAVE_SETENV
62 #define NPT_CONFIG_HAVE_UNSETENV
63 #if defined(TARGET_WINDOWS_STORE)
64 #undef NPT_CONFIG_HAVE_GETENV
65 #undef NPT_CONFIG_HAVE_SETENV
66 #undef NPT_CONFIG_HAVE_UNSETENV
68 #define NPT_CONFIG_HAVE_READDIR_R
69 #endif /* NPT_CONFIG_HAS_STD_C */
71 #if defined(NPT_CONFIG_HAVE_POSIX_TIME)
72 #define NPT_CONFIG_HAVE_GMTIME
73 #define NPT_CONFIG_HAVE_GMTIME_R
74 #define NPT_CONFIG_HAVE_LOCALTIME
75 #define NPT_CONFIG_HAVE_LOCALTIME_R
76 #define NPT_CONFIG_HAVE_TM_GMTOFF
79 #if defined(NPT_CONFIG_HAVE_STRING_H)
80 #define NPT_CONFIG_HAVE_STRCMP
81 #define NPT_CONFIG_HAVE_STRNCMP
82 #define NPT_CONFIG_HAVE_STRDUP
83 #define NPT_CONFIG_HAVE_STRLEN
84 #define NPT_CONFIG_HAVE_STRCPY
85 #define NPT_CONFIG_HAVE_STRNCPY
86 #endif /* NPT_CONFIG_HAVE_STRING_H */
88 #if defined(NPT_CONFIG_HAVE_STDIO_H)
89 #define NPT_CONFIG_HAVE_SPRINTF
90 #define NPT_CONFIG_HAVE_SNPRINTF
91 #define NPT_CONFIG_HAVE_VSPRINTF
92 #define NPT_CONFIG_HAVE_VSNPRINTF
93 #endif /* NPT_CONFIG_HAVE_STDIO_H */
95 #if defined(NPT_CONFIG_HAVE_LIMITS_H)
96 #define NPT_CONFIG_HAVE_INT_MIN
97 #define NPT_CONFIG_HAVE_INT_MAX
98 #define NPT_CONFIG_HAVE_UINT_MAX
99 #define NPT_CONFIG_HAVE_LONG_MIN
100 #define NPT_CONFIG_HAVE_LONG_MAX
101 #define NPT_CONFIG_HAVE_ULONG_MAX
104 /*----------------------------------------------------------------------
105 | standard C++ runtime
106 +---------------------------------------------------------------------*/
107 #define NPT_CONFIG_HAVE_NEW_H
109 /*----------------------------------------------------------------------
111 +---------------------------------------------------------------------*/
112 #define NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
114 /*----------------------------------------------------------------------
116 +---------------------------------------------------------------------*/
118 #if defined(_WIN32) || defined(_XBOX)
126 #define NPT_CONFIG_THREAD_STACK_SIZE 0x10000
131 #define NPT_CONFIG_HAVE_GETADDRINFO
135 #if defined(__CYGWIN__)
136 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
140 #if defined(__linux__)
141 #define NPT_CONFIG_HAVE_GETADDRINFO
142 //#define NPT_CONFIG_HAVE_GETIFADDRS // Linux has getifaddrs, but it doesn't return the MAC addrs
143 // in a convenient way, so we don't use it
144 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
145 #define NPT_CONFIG_HAVE_ARPA_INET_H
146 #define NPT_CONFIG_HAVE_INET_NTOP
147 #define NPT_CONFIG_HAVE_INET_PTON
151 #if defined(__SYMBIAN32__)
152 /* If defined, specify the stack size of each NPT_Thread. */
153 #define NPT_CONFIG_THREAD_STACK_SIZE 0x14000
158 #define NPT_CONFIG_HAVE_GETADDRINFO
159 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
160 #define NPT_CONFIG_HAVE_ARPA_INET_H
161 #define NPT_CONFIG_HAVE_INET_NTOP
162 #define NPT_CONFIG_HAVE_INET_PTON
166 #if defined(__APPLE__)
167 #define NPT_CONFIG_HAVE_GETADDRINFO
168 #define NPT_CONFIG_HAVE_GETIFADDRS
169 #define NPT_CONFIG_HAVE_AUTORELEASE_POOL
170 #define NPT_CONFIG_HAVE_SOCKADDR_IN_SIN_LEN
171 #define NPT_CONFIG_HAVE_ARPA_INET_H
172 #define NPT_CONFIG_HAVE_INET_NTOP
173 #define NPT_CONFIG_HAVE_INET_PTON
174 #define NPT_CONFIG_HAVE_NET_IF_DL_H
175 #define NPT_CONFIG_HAVE_SOCKADDR_DL
178 /*----------------------------------------------------------------------
180 +---------------------------------------------------------------------*/
182 #if defined(__GNUC__)
183 #define NPT_LocalFunctionName __FUNCTION__
184 #define NPT_COMPILER_UNUSED(p) (void)p
186 #define NPT_COMPILER_UNUSED(p)
189 /* TriMedia C/C++ Compiler */
191 #undef NPT_CONFIG_HAVE_ASSERT_H
192 #undef NPT_CONFIG_HAVE_SNPRINTF
193 #undef NPT_CONFIG_HAVE_VSNPRINTF
196 /* palmos compiler */
197 #if defined(__PALMOS__)
198 #if __PALMOS__ <= 0x05000000
199 #undef NPT_CONFIG_HAVE_ASSERT_H
200 #undef NPT_CONFIG_HAVE_SNPRINTF
201 #undef NPT_CONFIG_HAVE_VSNPRINTF
205 /* Microsoft C/C++ Compiler */
206 #if defined(_MSC_VER)
207 #undef NPT_CONFIG_HAVE_STDINT_H
208 #define NPT_CONFIG_HAVE_GETADDRINFO
209 #define NPT_CONFIG_STAT_ST_CTIME_IS_ST_BIRTHTIME
210 #define NPT_FORMAT_64 "I64"
211 #define NPT_CONFIG_INT64_TYPE __int64
212 #define NPT_INT64_MIN _I64_MIN
213 #define NPT_INT64_MAX _I64_MAX
214 #define NPT_UINT64_MAX _UI64_MAX
215 #define NPT_INT64_C(_x) _x##i64
216 #define NPT_UINT64_C(_x) _x##ui64
217 #define NPT_LocalFunctionName __FUNCTION__
218 #if !defined(_WIN32_WCE)
219 #define NPT_fseek _fseeki64
220 #define NPT_ftell _ftelli64
222 #define NPT_fseek(a,b,c) fseek((a),(long)(b), (c))
223 #define NPT_ftell ftell
225 #define NPT_stat NPT_stat_utf8
226 #define NPT_stat_struct struct __stat64
228 typedef __int64 NPT_PointerLong
;
231 typedef __w64
long NPT_PointerLong
;
233 typedef long NPT_PointerLong
;
236 #define NPT_POINTER_TO_LONG(_p) ((NPT_PointerLong) (_p) )
237 #if _MSC_VER >= 1400 && !defined(_WIN32_WCE)
238 #define gmtime_r(a,b) gmtime_s(a,b)
239 #define localtime_r(a,b) localtime_s(b,a)
240 #define NPT_CONFIG_HAVE_FOPEN_S
241 #define NPT_CONFIG_HAVE_FSOPEN
242 #define NPT_CONFIG_HAVE_SHARE_H
243 #define NPT_vsnprintf(s,c,f,a) _vsnprintf_s(s,c,_TRUNCATE,f,a)
244 #define NPT_snprintf(s,c,f,...) _snprintf_s(s,c,_TRUNCATE,f,__VA_ARGS__)
245 #define NPT_strncpy(d,s,c) strncpy_s(d,c+1,s,c)
246 #define NPT_strcpy(d,s) strcpy_s(d,strlen(s)+1,s)
247 #undef NPT_CONFIG_HAVE_GETENV
248 #ifdef TARGET_WINDOWS_STORE
249 #undef NPT_CONFIG_HAVE_GETENV
250 #undef NPT_CONFIG_HAVE_DUPENV_S
251 #undef NPT_CONFIG_HAVE_SETENV
252 #undef NPT_CONFIG_HAVE_UNSETENV
253 #undef NPT_CONFIG_HAVE_PUTENV_S
255 #define NPT_CONFIG_HAVE_DUPENV_S
256 #define dupenv_s _dupenv_s
257 #undef NPT_CONFIG_HAVE_SETENV
258 #undef NPT_CONFIG_HAVE_UNSETENV
259 #define NPT_CONFIG_HAVE_PUTENV_S
260 #define putenv_s _putenv_s
263 #undef NPT_CONFIG_HAVE_GMTIME_R
264 #undef NPT_CONFIG_HAVE_LOCALTIME_R
265 #define NPT_vsnprintf _vsnprintf
266 #define NPT_snprintf _snprintf
269 #define _CRTDBG_MAP_ALLOC
274 #if defined(_WIN32_WCE)
275 #if defined(NPT_CONFIG_HAVE_FOPEN_S)
276 #undef NPT_CONFIG_HAVE_FOPEN_S
281 #if defined(__SYMBIAN32__)
282 #undef NPT_CONFIG_HAVE_NEW_H
285 #define NPT_fseek fseek // no fseeko ?
286 #define NPT_ftell ftell // no ftello ?
291 #if !defined(NPT_CONFIG_NO_RTTI)
292 #define NPT_CONFIG_NO_RTTI
294 //#define NPT_ftell ftello64
295 //#define NPT_fseek fseeko64
299 #if defined(__APPLE__)
300 #include <TargetConditionals.h>
301 #include <AvailabilityMacros.h>
302 #if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
303 #define NPT_CONFIG_HAVE_NET_IF_TYPES_H
304 #if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
305 #define NPT_CONFIG_HAVE_STAT_ST_BIRTHTIME
307 #define NPT_CONFIG_HAVE_DEV_URANDOM
311 /*----------------------------------------------------------------------
313 +---------------------------------------------------------------------*/
314 #if !defined(NPT_FORMAT_64)
315 #define NPT_FORMAT_64 "ll"
318 #if !defined(NPT_POINTER_TO_LONG)
319 #define NPT_POINTER_TO_LONG(_p) ((long)(_p))
322 #if !defined(NPT_CONFIG_INT64_TYPE)
323 #define NPT_CONFIG_INT64_TYPE long long
326 #if !defined(NPT_INT64_C)
327 #define NPT_INT64_C(_x) _x##LL
330 #if !defined(NPT_UINT64_C)
331 #define NPT_UINT64_C(_x) _x##ULL
334 #if !defined(NPT_snprintf)
335 #define NPT_snprintf snprintf
338 #if !defined(NPT_strcpy)
339 #define NPT_strcpy strcpy
342 #if !defined(NPT_strncpy)
343 #define NPT_strncpy strncpy
346 #if !defined(NPT_vsnprintf)
347 #define NPT_vsnprintf vsnprintf
350 #if !defined(NPT_LocalFunctionName)
351 #define NPT_LocalFunctionName (NULL)
354 #if !defined(NPT_CONFIG_THREAD_STACK_SIZE)
355 #define NPT_CONFIG_THREAD_STACK_SIZE 0
358 #if !defined(NPT_fseek)
359 #define NPT_fseek fseeko
362 #if !defined(NPT_ftell)
363 #define NPT_ftell ftello
366 #if !defined(NPT_stat)
367 #define NPT_stat stat
370 #if !defined(NPT_stat_struct)
371 #define NPT_stat_struct struct stat
374 /*----------------------------------------------------------------------
376 +---------------------------------------------------------------------*/
381 #endif // _NPT_CONFIG_H_