1 /* Win32 version of xmlrpc_config.h. 2 3 For other platforms, this is generated automatically, but for Windows, 4 someone generates it manually. Nonetheless, we keep it looking as much 5 as possible like the automatically generated one to make it easier to 6 maintain (e.g. you can compare the two and see why something builds 7 differently for Windows than for some other platform). 8 9 The purpose of this file is to define stuff particular to the build 10 environment being used to build Xmlrpc-c. Xmlrpc-c source files can 11 #include this file and have build-environment-independent source code. 12 13 A major goal of this file is to reduce conditional compilation in 14 the other source files as much as possible. Even more, we want to avoid 15 having to generate source code particular to a build environment 16 except in this file. 17 18 This file is NOT meant to be used by any code outside of the 19 Xmlrpc-c source tree. There is a similar file that gets installed 20 as <xmlrpc-c/config.h> that performs the same function for Xmlrpc-c 21 interface header files that get compiled as part of a user's program. 22 23 Logical macros are 0 or 1 instead of the more traditional defined and 24 undefined. That's so we can distinguish when compiling code between 25 "false" and some problem with the code. 26 */ 27 28 #ifndef XMLRPC_CONFIG_H_INCLUDED 29 #define XMLRPC_CONFIG_H_INCLUDED 30 31 /* From xmlrpc_amconfig.h */ 32 33 #define HAVE__STRICMP 1 34 #define HAVE__STRTOUI64 1 35 36 /* Name of package */ 37 #define PACKAGE "xmlrpc-c" 38 /*----------------------------------*/ 39 40 #ifndef HAVE_SETGROUPS 41 #define HAVE_SETGROUPS 0 42 #endif 43 #ifndef HAVE_ASPRINTF 44 #define HAVE_ASPRINTF 0 45 #endif 46 #ifndef HAVE_SETENV 47 #define HAVE_SETENV 0 48 #endif 49 #ifndef HAVE_PSELECT 50 #define HAVE_PSELECT 0 51 #endif 52 #ifndef HAVE_WCSNCMP 53 #define HAVE_WCSNCMP 1 54 #endif 55 #ifndef HAVE_GETTIMEOFDAY 56 #define HAVE_GETTIMEOFDAY 0 57 #endif 58 #ifndef HAVE_LOCALTIME_R 59 #define HAVE_LOCALTIME_R 0 60 #endif 61 #ifndef HAVE_GMTIME_R 62 #define HAVE_GMTIME_R 0 63 #endif 64 #ifndef HAVE_STRCASECMP 65 #define HAVE_STRCASECMP 0 66 #endif 67 #ifndef HAVE_STRICMP 68 #define HAVE_STRICMP 0 69 #endif 70 #ifndef HAVE__STRICMP 71 #define HAVE__STRICMP 0 72 #endif 73 74 #define HAVE_WCHAR_H 1 75 #define HAVE_SYS_FILIO_H 0 76 #define HAVE_SYS_IOCTL_H 0 77 #define HAVE_SYS_SELECT_H 0 78 79 #define VA_LIST_IS_ARRAY 0 80 81 #define HAVE_LIBWWW_SSL 0 82 83 /* Used to mark an unused function parameter */ 84 #define ATTR_UNUSED 85 86 #define DIRECTORY_SEPARATOR "\\" 87 88 #define HAVE_UNICODE_WCHAR 1 89 90 /* Xmlrpc-c code uses __inline__ to declare functions that should 91 be compiled as inline code. GNU C recognizes the __inline__ keyword. 92 Others recognize 'inline' or '__inline' or nothing at all to say 93 a function should be inlined. 94 95 We could make 'configure' simply do a trial compile to figure out 96 which one, but for now, this approximation is easier: 97 */ 98 #if (!defined(__GNUC__)) 99 #if (!defined(__inline__)) 100 #if (defined(__sgi) || defined(_AIX) || defined(_MSC_VER)) 101 #define __inline__ __inline 102 #else 103 #define __inline__ 104 #endif 105 #endif 106 #endif 107 108 /* MSVCRT means we're using the Microsoft Visual C++ runtime library */ 109 110 /* MSVCRT means we're using the Microsoft Visual C++ runtime library, 111 msvcrt.dll. Note that there are other DLLs in the suite, but only the 112 basic msvcrt.dll comes with Windows. 113 */ 114 115 #if defined(_MSC_VER) 116 /* The compiler is Microsoft Visual C++ */ 117 #define MSVCRT _MSC_VER 118 #elif defined(__MINGW32__) 119 /* The compiler is Mingw, which is the Windows version of the GNU 120 compiler. Programs built with this normally use the Microsoft Visual 121 C++ runtime library, in addition to a small library with some of the 122 things a program would expect to find on a GNU system: libmingwex.a. 123 */ 124 #define MSVCRT 1 125 #else 126 #define MSVCRT 0 127 #endif 128 129 #if MSVCRT 130 /* The MSVC runtime library _does_ have a 'struct timeval', but it is 131 part of the Winsock interface (along with select(), which is probably 132 its intended use), so isn't intended for use for general timekeeping. 133 */ 134 #define HAVE_TIMEVAL 0 135 #define HAVE_TIMESPEC 0 136 #else 137 #define HAVE_TIMEVAL 1 138 /* timespec is Posix.1b. If we need to work on a non-Posix.1b non-Windows 139 system, we'll have to figure out how to make Configure determine this. 140 */ 141 #define HAVE_TIMESPEC 1 142 #endif 143 144 #if MSVCRT 145 #define HAVE_WINDOWS_THREAD 1 146 #else 147 #define HAVE_WINDOWS_THREAD 0 148 #endif 149 150 /* Some people have and use pthreads on Windows. See 151 http://sourceware.org/pthreads-win32 . For that case, we can set 152 HAVE_PTHREAD to 1. The builder prefers to use pthreads if it has 153 a choice. 154 */ 155 #define HAVE_PTHREAD 0 156 157 /* Note that the return value of XMLRPC_[V]SNPRINTF is int on Windows, 158 ssize_t on POSIX. On Windows, it is a return code; on POSIX, the size 159 of the complete string (regardless of how much of it got returned). 160 */ 161 #if MSVCRT 162 #define XMLRPC_SNPRINTF _snprintf 163 #define XMLRPC_VSNPRINTF _vsnprintf 164 #else 165 #define XMLRPC_SNPRINTF snprintf 166 #define XMLRPC_VSNPRINTF vsnprintf 167 #endif 168 169 #if MSVCRT 170 #define HAVE_REGEX 0 171 #else 172 #define HAVE_REGEX 1 173 #endif 174 175 #if MSVCRT 176 #define XMLRPC_SOCKETPAIR xmlrpc_win32_socketpair 177 #define XMLRPC_CLOSESOCKET closesocket 178 #else 179 #define XMLRPC_SOCKETPAIR socketpair 180 #define XMLRPC_CLOSESOCKET close 181 #endif 182 183 #if defined(_MSC_VER) && (_MSC_VER >= 1400) 184 /* Starting with MSVC 8, the runtime library defines various POSIX functions 185 such as strdup() whose names violate the ISO C standard (the standard 186 says the strXXX names are reserved for the standard), but warns you of 187 the standards violation. That warning is 4996, along with other warnings 188 that tell you you're using a function that Microsoft thinks you 189 shouldn't. 190 191 Well, POSIX is more important than that element of ISO C, so we disable 192 that warning. 193 194 FYI, msvcrt also defines _strdup(), etc, which doesn't violate the 195 naming standard. But since other environments don't define _strdup(), 196 we can't use it in portable code. 197 */ 198 #pragma warning(disable:4996) 199 #endif 200 /* Warning C4090 is "different 'const' qualifiers". 201 202 We disable this warning because MSVC erroneously issues it when there is 203 in fact no difference in const qualifiers: 204 205 const char ** p; 206 void * q; 207 q = p; 208 209 Note that both p and q are pointers to non-const. 210 211 We have seen this in MSVC 7.1, 8, and 9 (but not 6). 212 */ 213 #pragma warning(disable:4090) 214 215 #if HAVE_STRTOLL 216 # define XMLRPC_STRTOLL strtoll 217 #elif HAVE_STRTOQ 218 # define XMLRPC_STRTOLL strtoq /* Interix */ 219 #elif HAVE___STRTOLL 220 # define XMLRPC_STRTOLL __strtoll /* HP-UX <= 11.11 */ 221 #elif HAVE__STRTOUI64 222 #define XMLRPC_STRTOLL _strtoui64 /* Windows MSVC */ 223 #endif 224 225 #if HAVE_STRTOULL 226 # define XMLRPC_STRTOULL strtoull 227 #elif HAVE_STRTOUQ 228 # define XMLRPC_STRTOULL strtouq /* Interix */ 229 #elif HAVE___STRTOULL 230 # define XMLRPC_STRTOULL __strtoull /* HP-UX <= 11.11 */ 231 #elif HAVE__STRTOUI64 232 #define XMLRPC_STRTOULL _strtoui64 /* Windows MSVC */ 233 #endif 234 235 #if MSVCRT 236 #define popen _popen 237 #endif 238 239 /* S_IRUSR is POSIX, defined in <sys/stat.h> Some old BSD systems and Windows 240 systems have S_IREAD instead. Most Unix today (2011) has both. In 2011, 241 Android has S_IRUSR and not S_IREAD. 242 243 Some Windows (2011) has _S_IREAD. 244 245 We're ignoring S_IREAD now to see if anyone misses it. If there are still 246 users that need it, we can handle it here. 247 */ 248 #if MSVCRT 249 #define XMLRPC_S_IWUSR _S_IWRITE 250 #define XMLRPC_S_IRUSR _S_IREAD 251 #else 252 #define XMLRPC_S_IWUSR S_IWUSR 253 #define XMLRPC_S_IRUSR S_IRUSR 254 #endif 255 256 257 #if MSVCRT 258 #define XMLRPC_CHDIR _chdir 259 #else 260 #define XMLRPC_CHDIR chdir 261 #endif 262 263 #if MSVCRT 264 #define XMLRPC_FINITE _finite 265 #else 266 #define XMLRPC_FINITE finite 267 #endif 268 269 #if MSVCRT 270 #define XMLRPC_GETPID _getpid 271 #else 272 #define XMLRPC_GETPID getpid 273 #endif 274 275 #endif 276