system.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. #ifndef CURLINC_SYSTEM_H
  2. #define CURLINC_SYSTEM_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. ***************************************************************************/
  24. /*
  25. * Try to keep one section per platform, compiler and architecture, otherwise,
  26. * if an existing section is reused for a different one and later on the
  27. * original is adjusted, probably the piggybacking one can be adversely
  28. * changed.
  29. *
  30. * In order to differentiate between platforms/compilers/architectures use
  31. * only compiler built in predefined preprocessor symbols.
  32. *
  33. * curl_off_t
  34. * ----------
  35. *
  36. * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
  37. * wide signed integral data type. The width of this data type must remain
  38. * constant and independent of any possible large file support settings.
  39. *
  40. * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
  41. * wide signed integral data type if there is no 64-bit type.
  42. *
  43. * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
  44. * only be violated if off_t is the only 64-bit data type available and the
  45. * size of off_t is independent of large file support settings. Keep your
  46. * build on the safe side avoiding an off_t gating. If you have a 64-bit
  47. * off_t then take for sure that another 64-bit data type exists, dig deeper
  48. * and you will find it.
  49. *
  50. */
  51. #if defined(__DJGPP__) || defined(__GO32__)
  52. # if defined(__DJGPP__) && (__DJGPP__ > 1)
  53. # define CURL_TYPEOF_CURL_OFF_T long long
  54. # define CURL_FORMAT_CURL_OFF_T "lld"
  55. # define CURL_FORMAT_CURL_OFF_TU "llu"
  56. # define CURL_SUFFIX_CURL_OFF_T LL
  57. # define CURL_SUFFIX_CURL_OFF_TU ULL
  58. # else
  59. # define CURL_TYPEOF_CURL_OFF_T long
  60. # define CURL_FORMAT_CURL_OFF_T "ld"
  61. # define CURL_FORMAT_CURL_OFF_TU "lu"
  62. # define CURL_SUFFIX_CURL_OFF_T L
  63. # define CURL_SUFFIX_CURL_OFF_TU UL
  64. # endif
  65. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  66. #elif defined(__SALFORDC__)
  67. # define CURL_TYPEOF_CURL_OFF_T long
  68. # define CURL_FORMAT_CURL_OFF_T "ld"
  69. # define CURL_FORMAT_CURL_OFF_TU "lu"
  70. # define CURL_SUFFIX_CURL_OFF_T L
  71. # define CURL_SUFFIX_CURL_OFF_TU UL
  72. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  73. #elif defined(__BORLANDC__)
  74. # if (__BORLANDC__ < 0x520)
  75. # define CURL_TYPEOF_CURL_OFF_T long
  76. # define CURL_FORMAT_CURL_OFF_T "ld"
  77. # define CURL_FORMAT_CURL_OFF_TU "lu"
  78. # define CURL_SUFFIX_CURL_OFF_T L
  79. # define CURL_SUFFIX_CURL_OFF_TU UL
  80. # else
  81. # define CURL_TYPEOF_CURL_OFF_T __int64
  82. # define CURL_FORMAT_CURL_OFF_T "I64d"
  83. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  84. # define CURL_SUFFIX_CURL_OFF_T i64
  85. # define CURL_SUFFIX_CURL_OFF_TU ui64
  86. # endif
  87. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  88. #elif defined(__TURBOC__)
  89. # define CURL_TYPEOF_CURL_OFF_T long
  90. # define CURL_FORMAT_CURL_OFF_T "ld"
  91. # define CURL_FORMAT_CURL_OFF_TU "lu"
  92. # define CURL_SUFFIX_CURL_OFF_T L
  93. # define CURL_SUFFIX_CURL_OFF_TU UL
  94. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  95. #elif defined(__WATCOMC__)
  96. # if defined(__386__)
  97. # define CURL_TYPEOF_CURL_OFF_T __int64
  98. # define CURL_FORMAT_CURL_OFF_T "I64d"
  99. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  100. # define CURL_SUFFIX_CURL_OFF_T i64
  101. # define CURL_SUFFIX_CURL_OFF_TU ui64
  102. # else
  103. # define CURL_TYPEOF_CURL_OFF_T long
  104. # define CURL_FORMAT_CURL_OFF_T "ld"
  105. # define CURL_FORMAT_CURL_OFF_TU "lu"
  106. # define CURL_SUFFIX_CURL_OFF_T L
  107. # define CURL_SUFFIX_CURL_OFF_TU UL
  108. # endif
  109. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  110. #elif defined(__POCC__)
  111. # if (__POCC__ < 280)
  112. # define CURL_TYPEOF_CURL_OFF_T long
  113. # define CURL_FORMAT_CURL_OFF_T "ld"
  114. # define CURL_FORMAT_CURL_OFF_TU "lu"
  115. # define CURL_SUFFIX_CURL_OFF_T L
  116. # define CURL_SUFFIX_CURL_OFF_TU UL
  117. # elif defined(_MSC_VER)
  118. # define CURL_TYPEOF_CURL_OFF_T __int64
  119. # define CURL_FORMAT_CURL_OFF_T "I64d"
  120. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  121. # define CURL_SUFFIX_CURL_OFF_T i64
  122. # define CURL_SUFFIX_CURL_OFF_TU ui64
  123. # else
  124. # define CURL_TYPEOF_CURL_OFF_T long long
  125. # define CURL_FORMAT_CURL_OFF_T "lld"
  126. # define CURL_FORMAT_CURL_OFF_TU "llu"
  127. # define CURL_SUFFIX_CURL_OFF_T LL
  128. # define CURL_SUFFIX_CURL_OFF_TU ULL
  129. # endif
  130. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  131. #elif defined(__LCC__)
  132. # if defined(__e2k__) /* MCST eLbrus C Compiler */
  133. # define CURL_TYPEOF_CURL_OFF_T long
  134. # define CURL_FORMAT_CURL_OFF_T "ld"
  135. # define CURL_FORMAT_CURL_OFF_TU "lu"
  136. # define CURL_SUFFIX_CURL_OFF_T L
  137. # define CURL_SUFFIX_CURL_OFF_TU UL
  138. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  139. # define CURL_PULL_SYS_TYPES_H 1
  140. # define CURL_PULL_SYS_SOCKET_H 1
  141. # else /* Local (or Little) C Compiler */
  142. # define CURL_TYPEOF_CURL_OFF_T long
  143. # define CURL_FORMAT_CURL_OFF_T "ld"
  144. # define CURL_FORMAT_CURL_OFF_TU "lu"
  145. # define CURL_SUFFIX_CURL_OFF_T L
  146. # define CURL_SUFFIX_CURL_OFF_TU UL
  147. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  148. # endif
  149. #elif defined(__SYMBIAN32__)
  150. # if defined(__EABI__) /* Treat all ARM compilers equally */
  151. # define CURL_TYPEOF_CURL_OFF_T long long
  152. # define CURL_FORMAT_CURL_OFF_T "lld"
  153. # define CURL_FORMAT_CURL_OFF_TU "llu"
  154. # define CURL_SUFFIX_CURL_OFF_T LL
  155. # define CURL_SUFFIX_CURL_OFF_TU ULL
  156. # elif defined(__CW32__)
  157. # pragma longlong on
  158. # define CURL_TYPEOF_CURL_OFF_T long long
  159. # define CURL_FORMAT_CURL_OFF_T "lld"
  160. # define CURL_FORMAT_CURL_OFF_TU "llu"
  161. # define CURL_SUFFIX_CURL_OFF_T LL
  162. # define CURL_SUFFIX_CURL_OFF_TU ULL
  163. # elif defined(__VC32__)
  164. # define CURL_TYPEOF_CURL_OFF_T __int64
  165. # define CURL_FORMAT_CURL_OFF_T "lld"
  166. # define CURL_FORMAT_CURL_OFF_TU "llu"
  167. # define CURL_SUFFIX_CURL_OFF_T LL
  168. # define CURL_SUFFIX_CURL_OFF_TU ULL
  169. # endif
  170. # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
  171. #elif defined(__MWERKS__)
  172. # define CURL_TYPEOF_CURL_OFF_T long long
  173. # define CURL_FORMAT_CURL_OFF_T "lld"
  174. # define CURL_FORMAT_CURL_OFF_TU "llu"
  175. # define CURL_SUFFIX_CURL_OFF_T LL
  176. # define CURL_SUFFIX_CURL_OFF_TU ULL
  177. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  178. #elif defined(_WIN32_WCE)
  179. # define CURL_TYPEOF_CURL_OFF_T __int64
  180. # define CURL_FORMAT_CURL_OFF_T "I64d"
  181. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  182. # define CURL_SUFFIX_CURL_OFF_T i64
  183. # define CURL_SUFFIX_CURL_OFF_TU ui64
  184. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  185. #elif defined(__MINGW32__)
  186. # define CURL_TYPEOF_CURL_OFF_T long long
  187. # define CURL_FORMAT_CURL_OFF_T "I64d"
  188. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  189. # define CURL_SUFFIX_CURL_OFF_T LL
  190. # define CURL_SUFFIX_CURL_OFF_TU ULL
  191. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  192. # define CURL_PULL_SYS_TYPES_H 1
  193. # define CURL_PULL_WS2TCPIP_H 1
  194. #elif defined(__VMS)
  195. # if defined(__VAX)
  196. # define CURL_TYPEOF_CURL_OFF_T long
  197. # define CURL_FORMAT_CURL_OFF_T "ld"
  198. # define CURL_FORMAT_CURL_OFF_TU "lu"
  199. # define CURL_SUFFIX_CURL_OFF_T L
  200. # define CURL_SUFFIX_CURL_OFF_TU UL
  201. # else
  202. # define CURL_TYPEOF_CURL_OFF_T long long
  203. # define CURL_FORMAT_CURL_OFF_T "lld"
  204. # define CURL_FORMAT_CURL_OFF_TU "llu"
  205. # define CURL_SUFFIX_CURL_OFF_T LL
  206. # define CURL_SUFFIX_CURL_OFF_TU ULL
  207. # endif
  208. # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
  209. #elif defined(__OS400__)
  210. # if defined(__ILEC400__)
  211. # define CURL_TYPEOF_CURL_OFF_T long long
  212. # define CURL_FORMAT_CURL_OFF_T "lld"
  213. # define CURL_FORMAT_CURL_OFF_TU "llu"
  214. # define CURL_SUFFIX_CURL_OFF_T LL
  215. # define CURL_SUFFIX_CURL_OFF_TU ULL
  216. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  217. # define CURL_PULL_SYS_TYPES_H 1
  218. # define CURL_PULL_SYS_SOCKET_H 1
  219. # endif
  220. #elif defined(__MVS__)
  221. # if defined(__IBMC__) || defined(__IBMCPP__)
  222. # if defined(_ILP32)
  223. # elif defined(_LP64)
  224. # endif
  225. # if defined(_LONG_LONG)
  226. # define CURL_TYPEOF_CURL_OFF_T long long
  227. # define CURL_FORMAT_CURL_OFF_T "lld"
  228. # define CURL_FORMAT_CURL_OFF_TU "llu"
  229. # define CURL_SUFFIX_CURL_OFF_T LL
  230. # define CURL_SUFFIX_CURL_OFF_TU ULL
  231. # elif defined(_LP64)
  232. # define CURL_TYPEOF_CURL_OFF_T long
  233. # define CURL_FORMAT_CURL_OFF_T "ld"
  234. # define CURL_FORMAT_CURL_OFF_TU "lu"
  235. # define CURL_SUFFIX_CURL_OFF_T L
  236. # define CURL_SUFFIX_CURL_OFF_TU UL
  237. # else
  238. # define CURL_TYPEOF_CURL_OFF_T long
  239. # define CURL_FORMAT_CURL_OFF_T "ld"
  240. # define CURL_FORMAT_CURL_OFF_TU "lu"
  241. # define CURL_SUFFIX_CURL_OFF_T L
  242. # define CURL_SUFFIX_CURL_OFF_TU UL
  243. # endif
  244. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  245. # define CURL_PULL_SYS_TYPES_H 1
  246. # define CURL_PULL_SYS_SOCKET_H 1
  247. # endif
  248. #elif defined(__370__)
  249. # if defined(__IBMC__) || defined(__IBMCPP__)
  250. # if defined(_ILP32)
  251. # elif defined(_LP64)
  252. # endif
  253. # if defined(_LONG_LONG)
  254. # define CURL_TYPEOF_CURL_OFF_T long long
  255. # define CURL_FORMAT_CURL_OFF_T "lld"
  256. # define CURL_FORMAT_CURL_OFF_TU "llu"
  257. # define CURL_SUFFIX_CURL_OFF_T LL
  258. # define CURL_SUFFIX_CURL_OFF_TU ULL
  259. # elif defined(_LP64)
  260. # define CURL_TYPEOF_CURL_OFF_T long
  261. # define CURL_FORMAT_CURL_OFF_T "ld"
  262. # define CURL_FORMAT_CURL_OFF_TU "lu"
  263. # define CURL_SUFFIX_CURL_OFF_T L
  264. # define CURL_SUFFIX_CURL_OFF_TU UL
  265. # else
  266. # define CURL_TYPEOF_CURL_OFF_T long
  267. # define CURL_FORMAT_CURL_OFF_T "ld"
  268. # define CURL_FORMAT_CURL_OFF_TU "lu"
  269. # define CURL_SUFFIX_CURL_OFF_T L
  270. # define CURL_SUFFIX_CURL_OFF_TU UL
  271. # endif
  272. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  273. # define CURL_PULL_SYS_TYPES_H 1
  274. # define CURL_PULL_SYS_SOCKET_H 1
  275. # endif
  276. #elif defined(TPF)
  277. # define CURL_TYPEOF_CURL_OFF_T long
  278. # define CURL_FORMAT_CURL_OFF_T "ld"
  279. # define CURL_FORMAT_CURL_OFF_TU "lu"
  280. # define CURL_SUFFIX_CURL_OFF_T L
  281. # define CURL_SUFFIX_CURL_OFF_TU UL
  282. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  283. #elif defined(__TINYC__) /* also known as tcc */
  284. # define CURL_TYPEOF_CURL_OFF_T long long
  285. # define CURL_FORMAT_CURL_OFF_T "lld"
  286. # define CURL_FORMAT_CURL_OFF_TU "llu"
  287. # define CURL_SUFFIX_CURL_OFF_T LL
  288. # define CURL_SUFFIX_CURL_OFF_TU ULL
  289. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  290. # define CURL_PULL_SYS_TYPES_H 1
  291. # define CURL_PULL_SYS_SOCKET_H 1
  292. #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */
  293. # if !defined(__LP64) && (defined(__ILP32) || \
  294. defined(__i386) || \
  295. defined(__sparcv8) || \
  296. defined(__sparcv8plus))
  297. # define CURL_TYPEOF_CURL_OFF_T long long
  298. # define CURL_FORMAT_CURL_OFF_T "lld"
  299. # define CURL_FORMAT_CURL_OFF_TU "llu"
  300. # define CURL_SUFFIX_CURL_OFF_T LL
  301. # define CURL_SUFFIX_CURL_OFF_TU ULL
  302. # elif defined(__LP64) || \
  303. defined(__amd64) || defined(__sparcv9)
  304. # define CURL_TYPEOF_CURL_OFF_T long
  305. # define CURL_FORMAT_CURL_OFF_T "ld"
  306. # define CURL_FORMAT_CURL_OFF_TU "lu"
  307. # define CURL_SUFFIX_CURL_OFF_T L
  308. # define CURL_SUFFIX_CURL_OFF_TU UL
  309. # endif
  310. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  311. # define CURL_PULL_SYS_TYPES_H 1
  312. # define CURL_PULL_SYS_SOCKET_H 1
  313. #elif defined(__xlc__) /* IBM xlc compiler */
  314. # if !defined(_LP64)
  315. # define CURL_TYPEOF_CURL_OFF_T long long
  316. # define CURL_FORMAT_CURL_OFF_T "lld"
  317. # define CURL_FORMAT_CURL_OFF_TU "llu"
  318. # define CURL_SUFFIX_CURL_OFF_T LL
  319. # define CURL_SUFFIX_CURL_OFF_TU ULL
  320. # else
  321. # define CURL_TYPEOF_CURL_OFF_T long
  322. # define CURL_FORMAT_CURL_OFF_T "ld"
  323. # define CURL_FORMAT_CURL_OFF_TU "lu"
  324. # define CURL_SUFFIX_CURL_OFF_T L
  325. # define CURL_SUFFIX_CURL_OFF_TU UL
  326. # endif
  327. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  328. # define CURL_PULL_SYS_TYPES_H 1
  329. # define CURL_PULL_SYS_SOCKET_H 1
  330. /* ===================================== */
  331. /* KEEP MSVC THE PENULTIMATE ENTRY */
  332. /* ===================================== */
  333. #elif defined(_MSC_VER)
  334. # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
  335. # define CURL_TYPEOF_CURL_OFF_T __int64
  336. # define CURL_FORMAT_CURL_OFF_T "I64d"
  337. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  338. # define CURL_SUFFIX_CURL_OFF_T i64
  339. # define CURL_SUFFIX_CURL_OFF_TU ui64
  340. # else
  341. # define CURL_TYPEOF_CURL_OFF_T long
  342. # define CURL_FORMAT_CURL_OFF_T "ld"
  343. # define CURL_FORMAT_CURL_OFF_TU "lu"
  344. # define CURL_SUFFIX_CURL_OFF_T L
  345. # define CURL_SUFFIX_CURL_OFF_TU UL
  346. # endif
  347. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  348. /* ===================================== */
  349. /* KEEP GENERIC GCC THE LAST ENTRY */
  350. /* ===================================== */
  351. #elif defined(__GNUC__) && !defined(_SCO_DS)
  352. # if !defined(__LP64__) && \
  353. (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \
  354. defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \
  355. defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
  356. defined(__XTENSA__) || \
  357. (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \
  358. (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
  359. # define CURL_TYPEOF_CURL_OFF_T long long
  360. # define CURL_FORMAT_CURL_OFF_T "lld"
  361. # define CURL_FORMAT_CURL_OFF_TU "llu"
  362. # define CURL_SUFFIX_CURL_OFF_T LL
  363. # define CURL_SUFFIX_CURL_OFF_TU ULL
  364. # elif defined(__LP64__) || \
  365. defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
  366. defined(__e2k__) || \
  367. (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
  368. (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
  369. # define CURL_TYPEOF_CURL_OFF_T long
  370. # define CURL_FORMAT_CURL_OFF_T "ld"
  371. # define CURL_FORMAT_CURL_OFF_TU "lu"
  372. # define CURL_SUFFIX_CURL_OFF_T L
  373. # define CURL_SUFFIX_CURL_OFF_TU UL
  374. # endif
  375. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  376. # define CURL_PULL_SYS_TYPES_H 1
  377. # define CURL_PULL_SYS_SOCKET_H 1
  378. #else
  379. /* generic "safe guess" on old 32 bit style */
  380. # define CURL_TYPEOF_CURL_OFF_T long
  381. # define CURL_FORMAT_CURL_OFF_T "ld"
  382. # define CURL_FORMAT_CURL_OFF_TU "lu"
  383. # define CURL_SUFFIX_CURL_OFF_T L
  384. # define CURL_SUFFIX_CURL_OFF_TU UL
  385. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  386. #endif
  387. #ifdef _AIX
  388. /* AIX needs <sys/poll.h> */
  389. #define CURL_PULL_SYS_POLL_H
  390. #endif
  391. /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
  392. /* ws2tcpip.h is required here to properly make type definitions below. */
  393. #ifdef CURL_PULL_WS2TCPIP_H
  394. # include <winsock2.h>
  395. # include <windows.h>
  396. # include <ws2tcpip.h>
  397. #endif
  398. /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
  399. /* sys/types.h is required here to properly make type definitions below. */
  400. #ifdef CURL_PULL_SYS_TYPES_H
  401. # include <sys/types.h>
  402. #endif
  403. /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
  404. /* sys/socket.h is required here to properly make type definitions below. */
  405. #ifdef CURL_PULL_SYS_SOCKET_H
  406. # include <sys/socket.h>
  407. #endif
  408. /* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
  409. /* sys/poll.h is required here to properly make type definitions below. */
  410. #ifdef CURL_PULL_SYS_POLL_H
  411. # include <sys/poll.h>
  412. #endif
  413. /* Data type definition of curl_socklen_t. */
  414. #ifdef CURL_TYPEOF_CURL_SOCKLEN_T
  415. typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
  416. #endif
  417. /* Data type definition of curl_off_t. */
  418. #ifdef CURL_TYPEOF_CURL_OFF_T
  419. typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
  420. #endif
  421. /*
  422. * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
  423. * these to be visible and exported by the external libcurl interface API,
  424. * while also making them visible to the library internals, simply including
  425. * curl_setup.h, without actually needing to include curl.h internally.
  426. * If some day this section would grow big enough, all this should be moved
  427. * to its own header file.
  428. */
  429. /*
  430. * Figure out if we can use the ## preprocessor operator, which is supported
  431. * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
  432. * or __cplusplus so we need to carefully check for them too.
  433. */
  434. #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
  435. defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
  436. defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
  437. defined(__ILEC400__)
  438. /* This compiler is believed to have an ISO compatible preprocessor */
  439. #define CURL_ISOCPP
  440. #else
  441. /* This compiler is believed NOT to have an ISO compatible preprocessor */
  442. #undef CURL_ISOCPP
  443. #endif
  444. /*
  445. * Macros for minimum-width signed and unsigned curl_off_t integer constants.
  446. */
  447. #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
  448. # define CURLINC_OFF_T_C_HLPR2(x) x
  449. # define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x)
  450. # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
  451. CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
  452. # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
  453. CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
  454. #else
  455. # ifdef CURL_ISOCPP
  456. # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
  457. # else
  458. # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
  459. # endif
  460. # define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix)
  461. # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
  462. # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
  463. #endif
  464. #endif /* CURLINC_SYSTEM_H */