NptConfig.h

00001 /*****************************************************************
00002 |
00003 |   Neptune - Configuration
00004 |
00005 |   (c) 2002-2006 Gilles Boccon-Gibod
00006 |   Author: Gilles Boccon-Gibod (bok@bok.net)
00007 |
00008  ****************************************************************/
00009 
00010 #ifndef _NPT_CONFIG_H_
00011 #define _NPT_CONFIG_H_
00012 
00013 /*----------------------------------------------------------------------
00014 |   defaults
00015 +---------------------------------------------------------------------*/
00016 #define NPT_CONFIG_HAVE_ASSERT_H
00017 #define NPT_CONFIG_HAVE_STD_C
00018 #define NPT_CONFIG_HAVE_STDLIB_H
00019 #define NPT_CONFIG_HAVE_STDIO_H
00020 #define NPT_CONFIG_HAVE_STDARG_H
00021 #define NPT_CONFIG_HAVE_STRING_H
00022 
00023 /*----------------------------------------------------------------------
00024 |   standard C runtime
00025 +---------------------------------------------------------------------*/
00026 #if defined(NPT_CONFIG_HAVE_STD_C)
00027 #define NPT_CONFIG_HAVE_MALLOC
00028 #define NPT_CONFIG_HAVE_CALLOC
00029 #define NPT_CONFIG_HAVE_REALLOC
00030 #define NPT_CONFIG_HAVE_FREE
00031 #define NPT_CONFIG_HAVE_MEMCPY
00032 #define NPT_CONFIG_HAVE_MEMSET
00033 #define NPT_CONFIG_HAVE_MEMCMP
00034 #define NPT_CONFIG_HAVE_GETENV
00035 #endif /* NPT_CONFIG_HAS_STD_C */
00036 
00037 #if defined(NPT_CONFIG_HAVE_STRING_H)
00038 #define NPT_CONFIG_HAVE_STRCMP
00039 #define NPT_CONFIG_HAVE_STRNCMP
00040 #define NPT_CONFIG_HAVE_STRDUP
00041 #define NPT_CONFIG_HAVE_STRLEN
00042 #define NPT_CONFIG_HAVE_STRCPY
00043 #define NPT_CONFIG_HAVE_STRNCPY
00044 #endif /* NPT_CONFIG_HAVE_STRING_H */
00045 
00046 #if defined(NPT_CONFIG_HAVE_STDIO_H)
00047 #define NPT_CONFIG_HAVE_SPRINTF
00048 #define NPT_CONFIG_HAVE_SNPRINTF
00049 #define NPT_CONFIG_HAVE_VSPRINTF
00050 #define NPT_CONFIG_HAVE_VSNPRINTF
00051 #endif /* NPT_CONFIG_HAVE_STDIO_H */
00052 
00053 /*----------------------------------------------------------------------
00054 |   standard C++ runtime
00055 +---------------------------------------------------------------------*/
00056 #define NPT_CONFIG_HAVE_NEW_H
00057 
00058 /*----------------------------------------------------------------------
00059 |   sockets
00060 +---------------------------------------------------------------------*/
00061 #define NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
00062 
00063 /*----------------------------------------------------------------------
00064 |   platform specifics
00065 +---------------------------------------------------------------------*/
00066 /* Windows 32 */
00067 #if defined(_WIN32) || defined(_XBOX)
00068 #if !defined(STRICT)
00069 #define STRICT
00070 #endif
00071 #define vsnprintf _vsnprintf
00072 #define snprintf  _snprintf
00073 #endif
00074 
00075 /* QNX */
00076 #if defined(__QNX__)
00077 #endif
00078 
00079 /* cygwin */
00080 #if defined(__CYGWIN__)
00081 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
00082 #endif
00083 
00084 /* linux */
00085 #if defined(__linux__)
00086 #undef NPT_CONFIG_HAVE_SOCKADDR_SA_LEN
00087 #endif
00088 
00089 /*----------------------------------------------------------------------
00090 |   compiler specifics
00091 +---------------------------------------------------------------------*/
00092 /* GCC */
00093 #if defined(__GNUC__)
00094 #define NPT_COMPILER_UNUSED(p) (void)p
00095 #else
00096 #define NPT_COMPILER_UNUSED(p) 
00097 #endif
00098 
00099 /* TriMedia C/C++ Compiler */
00100 #if defined(__TCS__)
00101 #undef NPT_CONFIG_HAVE_ASSERT_H
00102 #undef NPT_CONFIG_HAVE_SNPRINTF
00103 #undef NPT_CONFIG_HAVE_VSNPRINTF
00104 #endif
00105 
00106 /* palmos compiler */
00107 #if defined(__PALMOS__)
00108 #if __PALMOS__ <= 0x05000000
00109 #undef NPT_CONFIG_HAVE_ASSERT_H
00110 #undef NPT_CONFIG_HAVE_SNPRINTF
00111 #undef NPT_CONFIG_HAVE_VSNPRINTF
00112 #endif
00113 #endif
00114 
00115 /* Microsoft C/C++ Compiler */
00116 #if defined(_MSC_VER)
00117 #if defined(_WIN64)
00118 typedef __int64 NPT_PointerLong;
00119 #else
00120 typedef __w64 long NPT_PointerLong;
00121 #endif
00122 #define NPT_POINTER_TO_LONG(_p) ((NPT_PointerLong) (_p) )
00123 #if _MSC_VER >= 1400 && !defined(_WIN32_WCE)
00124 #define NPT_CONFIG_HAVE_FOPEN_S
00125 #define NPT_CONFIG_HAVE_FSOPEN
00126 #define NPT_CONFIG_HAVE_SHARE_H
00127 #define NPT_vsnprintf(s,c,f,a)  _vsnprintf_s(s,c,_TRUNCATE,f,a)
00128 #define NPT_snprintf(s,c,f,...) _snprintf_s(s,c,_TRUNCATE,f,__VA_ARGS__)
00129 #define NPT_strncpy(d,s,c)       strncpy_s(d,c,s,_TRUNCATE)
00130 #undef NPT_CONFIG_HAVE_GETENV
00131 #define NPT_CONFIG_HAVE_DUPENV_S
00132 #define dupenv_s _dupenv_s
00133 #else
00134 #define NPT_vsnprintf  _vsnprintf
00135 #define NPT_snprintf   _snprintf
00136 #endif
00137 #if defined(_DEBUG)
00138 #define _CRTDBG_MAP_ALLOC
00139 #endif
00140 #endif
00141 
00142 /* Windows CE */
00143 #if defined(_WIN32_WCE)
00144 #if defined(NPT_CONFIG_HAVE_FOPEN_S)
00145 #undef NPT_CONFIG_HAVE_FOPEN_S
00146 #endif
00147 #endif
00148 
00149 /* Symbian */
00150 #if defined(__SYMBIAN32__)
00151 #undef NPT_CONFIG_HAVE_NEW_H
00152 #include "e32std.h"
00153 #define explicit
00154 #endif
00155 
00156 /*----------------------------------------------------------------------
00157 |   defaults
00158 +---------------------------------------------------------------------*/
00159 #ifndef NPT_POINTER_TO_LONG
00160 #define NPT_POINTER_TO_LONG(_p) ((long)(_p))
00161 #endif
00162 
00163 #if !defined(NPT_snprintf)
00164 #define NPT_snprintf snprintf
00165 #endif
00166 #if !defined(NPT_strncpy)
00167 #define NPT_strncpy strncpy
00168 #endif
00169 #if !defined(NPT_vsnprintf)
00170 #define NPT_vsnprintf vsnprintf
00171 #endif
00172 
00173 /*----------------------------------------------------------------------
00174 |   includes
00175 +---------------------------------------------------------------------*/
00176 #if defined(DMALLOC)
00177 #include <dmalloc.h>
00178 #endif
00179 
00180 #endif // _NPT_CONFIG_H_