curl_setup.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. #ifndef HEADER_CURL_SETUP_H
  2. #define HEADER_CURL_SETUP_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2014, 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 http://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. * Define WIN32 when build target is Win32 API
  26. */
  27. #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && \
  28. !defined(__SYMBIAN32__)
  29. #define WIN32
  30. #endif
  31. /*
  32. * Include configuration script results or hand-crafted
  33. * configuration file for platforms which lack config tool.
  34. */
  35. #ifdef HAVE_CONFIG_H
  36. #include "curl_config.h"
  37. #else /* HAVE_CONFIG_H */
  38. #ifdef _WIN32_WCE
  39. # include "config-win32ce.h"
  40. #else
  41. # ifdef WIN32
  42. # include "config-win32.h"
  43. # endif
  44. #endif
  45. #if defined(macintosh) && defined(__MRC__)
  46. # include "config-mac.h"
  47. #endif
  48. #ifdef __riscos__
  49. # include "config-riscos.h"
  50. #endif
  51. #ifdef __AMIGA__
  52. # include "config-amigaos.h"
  53. #endif
  54. #ifdef __SYMBIAN32__
  55. # include "config-symbian.h"
  56. #endif
  57. #ifdef __OS400__
  58. # include "config-os400.h"
  59. #endif
  60. #ifdef TPF
  61. # include "config-tpf.h"
  62. #endif
  63. #ifdef __VXWORKS__
  64. # include "config-vxworks.h"
  65. #endif
  66. #endif /* HAVE_CONFIG_H */
  67. /* ================================================================ */
  68. /* Definition of preprocessor macros/symbols which modify compiler */
  69. /* behavior or generated code characteristics must be done here, */
  70. /* as appropriate, before any system header file is included. It is */
  71. /* also possible to have them defined in the config file included */
  72. /* before this point. As a result of all this we frown inclusion of */
  73. /* system header files in our config files, avoid this at any cost. */
  74. /* ================================================================ */
  75. /*
  76. * AIX 4.3 and newer needs _THREAD_SAFE defined to build
  77. * proper reentrant code. Others may also need it.
  78. */
  79. #ifdef NEED_THREAD_SAFE
  80. # ifndef _THREAD_SAFE
  81. # define _THREAD_SAFE
  82. # endif
  83. #endif
  84. /*
  85. * Tru64 needs _REENTRANT set for a few function prototypes and
  86. * things to appear in the system header files. Unixware needs it
  87. * to build proper reentrant code. Others may also need it.
  88. */
  89. #ifdef NEED_REENTRANT
  90. # ifndef _REENTRANT
  91. # define _REENTRANT
  92. # endif
  93. #endif
  94. /* Solaris needs this to get a POSIX-conformant getpwuid_r */
  95. #if defined(sun) || defined(__sun)
  96. # ifndef _POSIX_PTHREAD_SEMANTICS
  97. # define _POSIX_PTHREAD_SEMANTICS 1
  98. # endif
  99. #endif
  100. /* ================================================================ */
  101. /* If you need to include a system header file for your platform, */
  102. /* please, do it beyond the point further indicated in this file. */
  103. /* ================================================================ */
  104. /*
  105. * libcurl's external interface definitions are also used internally,
  106. * and might also include required system header files to define them.
  107. */
  108. #include <curl/curlbuild.h>
  109. /*
  110. * Compile time sanity checks must also be done when building the library.
  111. */
  112. #include <curl/curlrules.h>
  113. /*
  114. * Ensure that no one is using the old SIZEOF_CURL_OFF_T macro
  115. */
  116. #ifdef SIZEOF_CURL_OFF_T
  117. # error "SIZEOF_CURL_OFF_T shall not be defined!"
  118. Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined
  119. #endif
  120. /*
  121. * Disable other protocols when http is the only one desired.
  122. */
  123. #ifdef HTTP_ONLY
  124. # ifndef CURL_DISABLE_TFTP
  125. # define CURL_DISABLE_TFTP
  126. # endif
  127. # ifndef CURL_DISABLE_FTP
  128. # define CURL_DISABLE_FTP
  129. # endif
  130. # ifndef CURL_DISABLE_LDAP
  131. # define CURL_DISABLE_LDAP
  132. # endif
  133. # ifndef CURL_DISABLE_TELNET
  134. # define CURL_DISABLE_TELNET
  135. # endif
  136. # ifndef CURL_DISABLE_DICT
  137. # define CURL_DISABLE_DICT
  138. # endif
  139. # ifndef CURL_DISABLE_FILE
  140. # define CURL_DISABLE_FILE
  141. # endif
  142. # ifndef CURL_DISABLE_RTSP
  143. # define CURL_DISABLE_RTSP
  144. # endif
  145. # ifndef CURL_DISABLE_POP3
  146. # define CURL_DISABLE_POP3
  147. # endif
  148. # ifndef CURL_DISABLE_IMAP
  149. # define CURL_DISABLE_IMAP
  150. # endif
  151. # ifndef CURL_DISABLE_SMTP
  152. # define CURL_DISABLE_SMTP
  153. # endif
  154. # ifndef CURL_DISABLE_RTSP
  155. # define CURL_DISABLE_RTSP
  156. # endif
  157. # ifndef CURL_DISABLE_RTMP
  158. # define CURL_DISABLE_RTMP
  159. # endif
  160. # ifndef CURL_DISABLE_GOPHER
  161. # define CURL_DISABLE_GOPHER
  162. # endif
  163. #endif
  164. /*
  165. * When http is disabled rtsp is not supported.
  166. */
  167. #if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP)
  168. # define CURL_DISABLE_RTSP
  169. #endif
  170. /* ================================================================ */
  171. /* No system header file shall be included in this file before this */
  172. /* point. The only allowed ones are those included from curlbuild.h */
  173. /* ================================================================ */
  174. /*
  175. * OS/400 setup file includes some system headers.
  176. */
  177. #ifdef __OS400__
  178. # include "setup-os400.h"
  179. #endif
  180. /*
  181. * VMS setup file includes some system headers.
  182. */
  183. #ifdef __VMS
  184. # include "setup-vms.h"
  185. #endif
  186. /*
  187. * Include header files for windows builds before redefining anything.
  188. * Use this preprocessor block only to include or exclude windows.h,
  189. * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
  190. * to any other further and independent block. Under Cygwin things work
  191. * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
  192. * never be included when __CYGWIN__ is defined. configure script takes
  193. * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
  194. * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
  195. */
  196. #ifdef HAVE_WINDOWS_H
  197. # if defined(UNICODE) && !defined(_UNICODE)
  198. # define _UNICODE
  199. # endif
  200. # if defined(_UNICODE) && !defined(UNICODE)
  201. # define UNICODE
  202. # endif
  203. # ifndef WIN32_LEAN_AND_MEAN
  204. # define WIN32_LEAN_AND_MEAN
  205. # endif
  206. # include <windows.h>
  207. # ifdef HAVE_WINSOCK2_H
  208. # include <winsock2.h>
  209. # ifdef HAVE_WS2TCPIP_H
  210. # include <ws2tcpip.h>
  211. # endif
  212. # else
  213. # ifdef HAVE_WINSOCK_H
  214. # include <winsock.h>
  215. # endif
  216. # endif
  217. # include <tchar.h>
  218. # ifdef UNICODE
  219. typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
  220. # endif
  221. #endif
  222. /*
  223. * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
  224. * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
  225. * undefine USE_WINSOCK.
  226. */
  227. #undef USE_WINSOCK
  228. #ifdef HAVE_WINSOCK2_H
  229. # define USE_WINSOCK 2
  230. #else
  231. # ifdef HAVE_WINSOCK_H
  232. # define USE_WINSOCK 1
  233. # endif
  234. #endif
  235. #ifdef USE_LWIPSOCK
  236. # include <lwip/init.h>
  237. # include <lwip/sockets.h>
  238. # include <lwip/netdb.h>
  239. #endif
  240. #ifdef HAVE_EXTRA_STRICMP_H
  241. # include <extra/stricmp.h>
  242. #endif
  243. #ifdef HAVE_EXTRA_STRDUP_H
  244. # include <extra/strdup.h>
  245. #endif
  246. #ifdef TPF
  247. # include <strings.h> /* for bzero, strcasecmp, and strncasecmp */
  248. # include <string.h> /* for strcpy and strlen */
  249. # include <stdlib.h> /* for rand and srand */
  250. # include <sys/socket.h> /* for select and ioctl*/
  251. # include <netdb.h> /* for in_addr_t definition */
  252. # include <tpf/sysapi.h> /* for tpf_process_signals */
  253. /* change which select is used for libcurl */
  254. # define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e)
  255. #endif
  256. #ifdef __VXWORKS__
  257. # include <sockLib.h> /* for generic BSD socket functions */
  258. # include <ioLib.h> /* for basic I/O interface functions */
  259. #endif
  260. #ifdef __AMIGA__
  261. # ifndef __ixemul__
  262. # include <exec/types.h>
  263. # include <exec/execbase.h>
  264. # include <proto/exec.h>
  265. # include <proto/dos.h>
  266. # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
  267. # endif
  268. #endif
  269. #include <stdio.h>
  270. #ifdef HAVE_ASSERT_H
  271. #include <assert.h>
  272. #endif
  273. #ifdef __TANDEM /* for nsr-tandem-nsk systems */
  274. #include <floss.h>
  275. #endif
  276. #ifndef STDC_HEADERS /* no standard C headers! */
  277. #include <curl/stdcheaders.h>
  278. #endif
  279. #ifdef __POCC__
  280. # include <sys/types.h>
  281. # include <unistd.h>
  282. # define sys_nerr EILSEQ
  283. #endif
  284. /*
  285. * Salford-C kludge section (mostly borrowed from wxWidgets).
  286. */
  287. #ifdef __SALFORDC__
  288. #pragma suppress 353 /* Possible nested comments */
  289. #pragma suppress 593 /* Define not used */
  290. #pragma suppress 61 /* enum has no name */
  291. #pragma suppress 106 /* unnamed, unused parameter */
  292. #include <clib.h>
  293. #endif
  294. /*
  295. * Large file (>2Gb) support using WIN32 functions.
  296. */
  297. #ifdef USE_WIN32_LARGE_FILES
  298. # include <io.h>
  299. # include <sys/types.h>
  300. # include <sys/stat.h>
  301. # undef lseek
  302. # define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence)
  303. # undef fstat
  304. # define fstat(fdes,stp) _fstati64(fdes, stp)
  305. # undef stat
  306. # define stat(fname,stp) _stati64(fname, stp)
  307. # define struct_stat struct _stati64
  308. # define LSEEK_ERROR (__int64)-1
  309. #endif
  310. /*
  311. * Small file (<2Gb) support using WIN32 functions.
  312. */
  313. #ifdef USE_WIN32_SMALL_FILES
  314. # include <io.h>
  315. # include <sys/types.h>
  316. # include <sys/stat.h>
  317. # ifndef _WIN32_WCE
  318. # undef lseek
  319. # define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
  320. # define fstat(fdes,stp) _fstat(fdes, stp)
  321. # define stat(fname,stp) _stat(fname, stp)
  322. # define struct_stat struct _stat
  323. # endif
  324. # define LSEEK_ERROR (long)-1
  325. #endif
  326. #ifndef struct_stat
  327. # define struct_stat struct stat
  328. #endif
  329. #ifndef LSEEK_ERROR
  330. # define LSEEK_ERROR (off_t)-1
  331. #endif
  332. /*
  333. * Default sizeof(off_t) in case it hasn't been defined in config file.
  334. */
  335. #ifndef SIZEOF_OFF_T
  336. # if defined(__VMS) && !defined(__VAX)
  337. # if defined(_LARGEFILE)
  338. # define SIZEOF_OFF_T 8
  339. # endif
  340. # elif defined(__OS400__) && defined(__ILEC400__)
  341. # if defined(_LARGE_FILES)
  342. # define SIZEOF_OFF_T 8
  343. # endif
  344. # elif defined(__MVS__) && defined(__IBMC__)
  345. # if defined(_LP64) || defined(_LARGE_FILES)
  346. # define SIZEOF_OFF_T 8
  347. # endif
  348. # elif defined(__370__) && defined(__IBMC__)
  349. # if defined(_LP64) || defined(_LARGE_FILES)
  350. # define SIZEOF_OFF_T 8
  351. # endif
  352. # endif
  353. # ifndef SIZEOF_OFF_T
  354. # define SIZEOF_OFF_T 4
  355. # endif
  356. #endif
  357. /*
  358. * Arg 2 type for gethostname in case it hasn't been defined in config file.
  359. */
  360. #ifndef GETHOSTNAME_TYPE_ARG2
  361. # ifdef USE_WINSOCK
  362. # define GETHOSTNAME_TYPE_ARG2 int
  363. # else
  364. # define GETHOSTNAME_TYPE_ARG2 size_t
  365. # endif
  366. #endif
  367. /* Below we define some functions. They should
  368. 4. set the SIGALRM signal timeout
  369. 5. set dir/file naming defines
  370. */
  371. #ifdef WIN32
  372. # define DIR_CHAR "\\"
  373. # define DOT_CHAR "_"
  374. #else /* WIN32 */
  375. # ifdef MSDOS /* Watt-32 */
  376. # include <sys/ioctl.h>
  377. # define select(n,r,w,x,t) select_s(n,r,w,x,t)
  378. # define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
  379. # include <tcp.h>
  380. # ifdef word
  381. # undef word
  382. # endif
  383. # ifdef byte
  384. # undef byte
  385. # endif
  386. # endif /* MSDOS */
  387. # ifdef __minix
  388. /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
  389. extern char * strtok_r(char *s, const char *delim, char **last);
  390. extern struct tm * gmtime_r(const time_t * const timep, struct tm *tmp);
  391. # endif
  392. # define DIR_CHAR "/"
  393. # ifndef DOT_CHAR
  394. # define DOT_CHAR "."
  395. # endif
  396. # ifdef MSDOS
  397. # undef DOT_CHAR
  398. # define DOT_CHAR "_"
  399. # endif
  400. # ifndef fileno /* sunos 4 have this as a macro! */
  401. int fileno( FILE *stream);
  402. # endif
  403. #endif /* WIN32 */
  404. /*
  405. * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN
  406. * defined in ws2tcpip.h as well as to provide IPv6 support.
  407. */
  408. #if defined(_MSC_VER) && !defined(__POCC__)
  409. # if !defined(HAVE_WS2TCPIP_H) || \
  410. ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN))
  411. # undef HAVE_GETADDRINFO_THREADSAFE
  412. # undef HAVE_FREEADDRINFO
  413. # undef HAVE_GETADDRINFO
  414. # undef HAVE_GETNAMEINFO
  415. # undef ENABLE_IPV6
  416. # endif
  417. #endif
  418. /* ---------------------------------------------------------------- */
  419. /* resolver specialty compile-time defines */
  420. /* CURLRES_* defines to use in the host*.c sources */
  421. /* ---------------------------------------------------------------- */
  422. /*
  423. * lcc-win32 doesn't have _beginthreadex(), lacks threads support.
  424. */
  425. #if defined(__LCC__) && defined(WIN32)
  426. # undef USE_THREADS_POSIX
  427. # undef USE_THREADS_WIN32
  428. #endif
  429. /*
  430. * MSVC threads support requires a multi-threaded runtime library.
  431. * _beginthreadex() is not available in single-threaded ones.
  432. */
  433. #if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT)
  434. # undef USE_THREADS_POSIX
  435. # undef USE_THREADS_WIN32
  436. #endif
  437. /*
  438. * Mutually exclusive CURLRES_* definitions.
  439. */
  440. #ifdef USE_ARES
  441. # define CURLRES_ASYNCH
  442. # define CURLRES_ARES
  443. /* now undef the stock libc functions just to avoid them being used */
  444. # undef HAVE_GETADDRINFO
  445. # undef HAVE_GETHOSTBYNAME
  446. #elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
  447. # define CURLRES_ASYNCH
  448. # define CURLRES_THREADED
  449. #else
  450. # define CURLRES_SYNCH
  451. #endif
  452. #ifdef ENABLE_IPV6
  453. # define CURLRES_IPV6
  454. #else
  455. # define CURLRES_IPV4
  456. #endif
  457. /* ---------------------------------------------------------------- */
  458. /*
  459. * When using WINSOCK, TELNET protocol requires WINSOCK2 API.
  460. */
  461. #if defined(USE_WINSOCK) && (USE_WINSOCK != 2)
  462. # define CURL_DISABLE_TELNET 1
  463. #endif
  464. /*
  465. * msvc 6.0 does not have struct sockaddr_storage and
  466. * does not define IPPROTO_ESP in winsock2.h. But both
  467. * are available if PSDK is properly installed.
  468. */
  469. #if defined(_MSC_VER) && !defined(__POCC__)
  470. # if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))
  471. # undef HAVE_STRUCT_SOCKADDR_STORAGE
  472. # endif
  473. #endif
  474. /*
  475. * Intentionally fail to build when using msvc 6.0 without PSDK installed.
  476. * The brave of heart can circumvent this, defining ALLOW_MSVC6_WITHOUT_PSDK
  477. * in lib/config-win32.h although absolutely discouraged and unsupported.
  478. */
  479. #if defined(_MSC_VER) && !defined(__POCC__)
  480. # if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_))
  481. # if !defined(ALLOW_MSVC6_WITHOUT_PSDK)
  482. # error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. \
  483. "Windows Server 2003 PSDK"
  484. # else
  485. # define CURL_DISABLE_LDAP 1
  486. # endif
  487. # endif
  488. #endif
  489. #ifdef NETWARE
  490. int netware_init(void);
  491. #ifndef __NOVELL_LIBC__
  492. #include <sys/bsdskt.h>
  493. #include <sys/timeval.h>
  494. #endif
  495. #endif
  496. #if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H)
  497. /* The lib was present and the tld.h header (which is missing in libidn 0.3.X
  498. but we only work with libidn 0.4.1 or later) */
  499. #define USE_LIBIDN
  500. #endif
  501. #ifndef SIZEOF_TIME_T
  502. /* assume default size of time_t to be 32 bit */
  503. #define SIZEOF_TIME_T 4
  504. #endif
  505. #define LIBIDN_REQUIRED_VERSION "0.4.1"
  506. #if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || \
  507. defined(USE_POLARSSL) || defined(USE_AXTLS) || \
  508. defined(USE_CYASSL) || defined(USE_SCHANNEL) || \
  509. defined(USE_DARWINSSL) || defined(USE_GSKIT)
  510. #define USE_SSL /* SSL support has been enabled */
  511. #endif
  512. /* Single point where USE_SPNEGO definition might be defined */
  513. #if !defined(CURL_DISABLE_CRYPTO_AUTH) && \
  514. (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
  515. #define USE_SPNEGO
  516. #endif
  517. /* Single point where USE_KERBEROS5 definition might be defined */
  518. #if !defined(CURL_DISABLE_CRYPTO_AUTH) && \
  519. (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
  520. #define USE_KERBEROS5
  521. #endif
  522. /* Single point where USE_NTLM definition might be defined */
  523. #if !defined(CURL_DISABLE_NTLM) && !defined(CURL_DISABLE_CRYPTO_AUTH)
  524. #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI) || \
  525. defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_DARWINSSL) || \
  526. defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO)
  527. #define USE_NTLM
  528. #endif
  529. #endif
  530. /* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */
  531. #if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)
  532. #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
  533. #endif
  534. /*
  535. * Provide a mechanism to silence picky compilers, such as gcc 4.6+.
  536. * Parameters should of course normally not be unused, but for example when
  537. * we have multiple implementations of the same interface it may happen.
  538. */
  539. #if defined(__GNUC__) && ((__GNUC__ >= 3) || \
  540. ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
  541. # define UNUSED_PARAM __attribute__((__unused__))
  542. # define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
  543. #else
  544. # define UNUSED_PARAM /*NOTHING*/
  545. # define WARN_UNUSED_RESULT
  546. #endif
  547. /*
  548. * Include macros and defines that should only be processed once.
  549. */
  550. #ifndef HEADER_CURL_SETUP_ONCE_H
  551. #include "curl_setup_once.h"
  552. #endif
  553. /*
  554. * Definition of our NOP statement Object-like macro
  555. */
  556. #ifndef Curl_nop_stmt
  557. # define Curl_nop_stmt do { } WHILE_FALSE
  558. #endif
  559. /*
  560. * Ensure that Winsock and lwIP TCP/IP stacks are not mixed.
  561. */
  562. #if defined(__LWIP_OPT_H__)
  563. # if defined(SOCKET) || \
  564. defined(USE_WINSOCK) || \
  565. defined(HAVE_WINSOCK_H) || \
  566. defined(HAVE_WINSOCK2_H) || \
  567. defined(HAVE_WS2TCPIP_H)
  568. # error "Winsock and lwIP TCP/IP stack definitions shall not coexist!"
  569. # endif
  570. #endif
  571. /*
  572. * Portable symbolic names for Winsock shutdown() mode flags.
  573. */
  574. #ifdef USE_WINSOCK
  575. # define SHUT_RD 0x00
  576. # define SHUT_WR 0x01
  577. # define SHUT_RDWR 0x02
  578. #endif
  579. /* Define S_ISREG if not defined by system headers, f.e. MSVC */
  580. #if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
  581. #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  582. #endif
  583. /* Define S_ISDIR if not defined by system headers, f.e. MSVC */
  584. #if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
  585. #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  586. #endif
  587. #endif /* HEADER_CURL_SETUP_H */