system.h 19 KB

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