curl_setup.h 18 KB

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