curl_setup.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. #ifndef HEADER_CURL_SETUP_H
  2. #define HEADER_CURL_SETUP_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2015, 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. # ifndef CURL_DISABLE_SMB
  167. # define CURL_DISABLE_SMB
  168. # endif
  169. #endif
  170. /*
  171. * When http is disabled rtsp is not supported.
  172. */
  173. #if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP)
  174. # define CURL_DISABLE_RTSP
  175. #endif
  176. /* ================================================================ */
  177. /* No system header file shall be included in this file before this */
  178. /* point. The only allowed ones are those included from curlbuild.h */
  179. /* ================================================================ */
  180. /*
  181. * OS/400 setup file includes some system headers.
  182. */
  183. #ifdef __OS400__
  184. # include "setup-os400.h"
  185. #endif
  186. /*
  187. * VMS setup file includes some system headers.
  188. */
  189. #ifdef __VMS
  190. # include "setup-vms.h"
  191. #endif
  192. /*
  193. * Include header files for windows builds before redefining anything.
  194. * Use this preprocessor block only to include or exclude windows.h,
  195. * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
  196. * to any other further and independent block. Under Cygwin things work
  197. * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
  198. * never be included when __CYGWIN__ is defined. configure script takes
  199. * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
  200. * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
  201. */
  202. #ifdef HAVE_WINDOWS_H
  203. # if defined(UNICODE) && !defined(_UNICODE)
  204. # define _UNICODE
  205. # endif
  206. # if defined(_UNICODE) && !defined(UNICODE)
  207. # define UNICODE
  208. # endif
  209. # ifndef WIN32_LEAN_AND_MEAN
  210. # define WIN32_LEAN_AND_MEAN
  211. # endif
  212. # include <windows.h>
  213. # ifdef HAVE_WINSOCK2_H
  214. # include <winsock2.h>
  215. # ifdef HAVE_WS2TCPIP_H
  216. # include <ws2tcpip.h>
  217. # endif
  218. # else
  219. # ifdef HAVE_WINSOCK_H
  220. # include <winsock.h>
  221. # endif
  222. # endif
  223. # include <tchar.h>
  224. # ifdef UNICODE
  225. typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
  226. # endif
  227. #endif
  228. /*
  229. * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
  230. * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
  231. * undefine USE_WINSOCK.
  232. */
  233. #undef USE_WINSOCK
  234. #ifdef HAVE_WINSOCK2_H
  235. # define USE_WINSOCK 2
  236. #else
  237. # ifdef HAVE_WINSOCK_H
  238. # define USE_WINSOCK 1
  239. # endif
  240. #endif
  241. #ifdef USE_LWIPSOCK
  242. # include <lwip/init.h>
  243. # include <lwip/sockets.h>
  244. # include <lwip/netdb.h>
  245. #endif
  246. #ifdef HAVE_EXTRA_STRICMP_H
  247. # include <extra/stricmp.h>
  248. #endif
  249. #ifdef HAVE_EXTRA_STRDUP_H
  250. # include <extra/strdup.h>
  251. #endif
  252. #ifdef TPF
  253. # include <strings.h> /* for bzero, strcasecmp, and strncasecmp */
  254. # include <string.h> /* for strcpy and strlen */
  255. # include <stdlib.h> /* for rand and srand */
  256. # include <sys/socket.h> /* for select and ioctl*/
  257. # include <netdb.h> /* for in_addr_t definition */
  258. # include <tpf/sysapi.h> /* for tpf_process_signals */
  259. /* change which select is used for libcurl */
  260. # define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e)
  261. #endif
  262. #ifdef __VXWORKS__
  263. # include <sockLib.h> /* for generic BSD socket functions */
  264. # include <ioLib.h> /* for basic I/O interface functions */
  265. #endif
  266. #ifdef __AMIGA__
  267. # ifndef __ixemul__
  268. # include <exec/types.h>
  269. # include <exec/execbase.h>
  270. # include <proto/exec.h>
  271. # include <proto/dos.h>
  272. # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
  273. # endif
  274. #endif
  275. #include <stdio.h>
  276. #ifdef HAVE_ASSERT_H
  277. #include <assert.h>
  278. #endif
  279. #ifdef __TANDEM /* for nsr-tandem-nsk systems */
  280. #include <floss.h>
  281. #endif
  282. #ifndef STDC_HEADERS /* no standard C headers! */
  283. #include <curl/stdcheaders.h>
  284. #endif
  285. #ifdef __POCC__
  286. # include <sys/types.h>
  287. # include <unistd.h>
  288. # define sys_nerr EILSEQ
  289. #endif
  290. /*
  291. * Salford-C kludge section (mostly borrowed from wxWidgets).
  292. */
  293. #ifdef __SALFORDC__
  294. #pragma suppress 353 /* Possible nested comments */
  295. #pragma suppress 593 /* Define not used */
  296. #pragma suppress 61 /* enum has no name */
  297. #pragma suppress 106 /* unnamed, unused parameter */
  298. #include <clib.h>
  299. #endif
  300. /* Default Windows file API selection. */
  301. #ifdef _WIN32
  302. # if defined(_MSC_VER) && (_INTEGRAL_MAX_BITS >= 64)
  303. # define USE_WIN32_LARGE_FILES
  304. # elif defined(__MINGW32__)
  305. # define USE_WIN32_LARGE_FILES
  306. # else
  307. # define USE_WIN32_SMALL_FILES
  308. # endif
  309. #endif
  310. /*
  311. * Large file (>2Gb) support using WIN32 functions.
  312. */
  313. #ifdef USE_WIN32_LARGE_FILES
  314. # include <io.h>
  315. # include <sys/types.h>
  316. # include <sys/stat.h>
  317. # undef lseek
  318. # define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence)
  319. # undef fstat
  320. # define fstat(fdes,stp) _fstati64(fdes, stp)
  321. # undef stat
  322. # define stat(fname,stp) _stati64(fname, stp)
  323. # define struct_stat struct _stati64
  324. # define LSEEK_ERROR (__int64)-1
  325. #endif
  326. /*
  327. * Small file (<2Gb) support using WIN32 functions.
  328. */
  329. #ifdef USE_WIN32_SMALL_FILES
  330. # include <io.h>
  331. # include <sys/types.h>
  332. # include <sys/stat.h>
  333. # ifndef _WIN32_WCE
  334. # undef lseek
  335. # define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
  336. # define fstat(fdes,stp) _fstat(fdes, stp)
  337. # define stat(fname,stp) _stat(fname, stp)
  338. # define struct_stat struct _stat
  339. # endif
  340. # define LSEEK_ERROR (long)-1
  341. #endif
  342. #ifndef struct_stat
  343. # define struct_stat struct stat
  344. #endif
  345. #ifndef LSEEK_ERROR
  346. # define LSEEK_ERROR (off_t)-1
  347. #endif
  348. /*
  349. * Default sizeof(off_t) in case it hasn't been defined in config file.
  350. */
  351. #ifndef SIZEOF_OFF_T
  352. # if defined(__VMS) && !defined(__VAX)
  353. # if defined(_LARGEFILE)
  354. # define SIZEOF_OFF_T 8
  355. # endif
  356. # elif defined(__OS400__) && defined(__ILEC400__)
  357. # if defined(_LARGE_FILES)
  358. # define SIZEOF_OFF_T 8
  359. # endif
  360. # elif defined(__MVS__) && defined(__IBMC__)
  361. # if defined(_LP64) || defined(_LARGE_FILES)
  362. # define SIZEOF_OFF_T 8
  363. # endif
  364. # elif defined(__370__) && defined(__IBMC__)
  365. # if defined(_LP64) || defined(_LARGE_FILES)
  366. # define SIZEOF_OFF_T 8
  367. # endif
  368. # endif
  369. # ifndef SIZEOF_OFF_T
  370. # define SIZEOF_OFF_T 4
  371. # endif
  372. #endif
  373. /*
  374. * Arg 2 type for gethostname in case it hasn't been defined in config file.
  375. */
  376. #ifndef GETHOSTNAME_TYPE_ARG2
  377. # ifdef USE_WINSOCK
  378. # define GETHOSTNAME_TYPE_ARG2 int
  379. # else
  380. # define GETHOSTNAME_TYPE_ARG2 size_t
  381. # endif
  382. #endif
  383. /* Below we define some functions. They should
  384. 4. set the SIGALRM signal timeout
  385. 5. set dir/file naming defines
  386. */
  387. #ifdef WIN32
  388. # define DIR_CHAR "\\"
  389. # define DOT_CHAR "_"
  390. #else /* WIN32 */
  391. # ifdef MSDOS /* Watt-32 */
  392. # include <sys/ioctl.h>
  393. # define select(n,r,w,x,t) select_s(n,r,w,x,t)
  394. # define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
  395. # include <tcp.h>
  396. # ifdef word
  397. # undef word
  398. # endif
  399. # ifdef byte
  400. # undef byte
  401. # endif
  402. # endif /* MSDOS */
  403. # ifdef __minix
  404. /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
  405. extern char * strtok_r(char *s, const char *delim, char **last);
  406. extern struct tm * gmtime_r(const time_t * const timep, struct tm *tmp);
  407. # endif
  408. # define DIR_CHAR "/"
  409. # ifndef DOT_CHAR
  410. # define DOT_CHAR "."
  411. # endif
  412. # ifdef MSDOS
  413. # undef DOT_CHAR
  414. # define DOT_CHAR "_"
  415. # endif
  416. # ifndef fileno /* sunos 4 have this as a macro! */
  417. int fileno( FILE *stream);
  418. # endif
  419. #endif /* WIN32 */
  420. /*
  421. * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN
  422. * defined in ws2tcpip.h as well as to provide IPv6 support.
  423. */
  424. #if defined(_MSC_VER) && !defined(__POCC__)
  425. # if !defined(HAVE_WS2TCPIP_H) || \
  426. ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN))
  427. # undef HAVE_GETADDRINFO_THREADSAFE
  428. # undef HAVE_FREEADDRINFO
  429. # undef HAVE_GETADDRINFO
  430. # undef HAVE_GETNAMEINFO
  431. # undef ENABLE_IPV6
  432. # endif
  433. #endif
  434. /* ---------------------------------------------------------------- */
  435. /* resolver specialty compile-time defines */
  436. /* CURLRES_* defines to use in the host*.c sources */
  437. /* ---------------------------------------------------------------- */
  438. /*
  439. * lcc-win32 doesn't have _beginthreadex(), lacks threads support.
  440. */
  441. #if defined(__LCC__) && defined(WIN32)
  442. # undef USE_THREADS_POSIX
  443. # undef USE_THREADS_WIN32
  444. #endif
  445. /*
  446. * MSVC threads support requires a multi-threaded runtime library.
  447. * _beginthreadex() is not available in single-threaded ones.
  448. */
  449. #if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT)
  450. # undef USE_THREADS_POSIX
  451. # undef USE_THREADS_WIN32
  452. #endif
  453. /*
  454. * Mutually exclusive CURLRES_* definitions.
  455. */
  456. #ifdef USE_ARES
  457. # define CURLRES_ASYNCH
  458. # define CURLRES_ARES
  459. /* now undef the stock libc functions just to avoid them being used */
  460. # undef HAVE_GETADDRINFO
  461. # undef HAVE_GETHOSTBYNAME
  462. #elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
  463. # define CURLRES_ASYNCH
  464. # define CURLRES_THREADED
  465. #else
  466. # define CURLRES_SYNCH
  467. #endif
  468. #ifdef ENABLE_IPV6
  469. # define CURLRES_IPV6
  470. #else
  471. # define CURLRES_IPV4
  472. #endif
  473. /* ---------------------------------------------------------------- */
  474. /*
  475. * When using WINSOCK, TELNET protocol requires WINSOCK2 API.
  476. */
  477. #if defined(USE_WINSOCK) && (USE_WINSOCK != 2)
  478. # define CURL_DISABLE_TELNET 1
  479. #endif
  480. /*
  481. * msvc 6.0 does not have struct sockaddr_storage and
  482. * does not define IPPROTO_ESP in winsock2.h. But both
  483. * are available if PSDK is properly installed.
  484. */
  485. #if defined(_MSC_VER) && !defined(__POCC__)
  486. # if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))
  487. # undef HAVE_STRUCT_SOCKADDR_STORAGE
  488. # endif
  489. #endif
  490. /*
  491. * Intentionally fail to build when using msvc 6.0 without PSDK installed.
  492. * The brave of heart can circumvent this, defining ALLOW_MSVC6_WITHOUT_PSDK
  493. * in lib/config-win32.h although absolutely discouraged and unsupported.
  494. */
  495. #if defined(_MSC_VER) && !defined(__POCC__)
  496. # if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_))
  497. # if !defined(ALLOW_MSVC6_WITHOUT_PSDK)
  498. # error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. \
  499. "Windows Server 2003 PSDK"
  500. # else
  501. # define CURL_DISABLE_LDAP 1
  502. # endif
  503. # endif
  504. #endif
  505. #ifdef NETWARE
  506. int netware_init(void);
  507. #ifndef __NOVELL_LIBC__
  508. #include <sys/bsdskt.h>
  509. #include <sys/timeval.h>
  510. #endif
  511. #endif
  512. #if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H)
  513. /* The lib was present and the tld.h header (which is missing in libidn 0.3.X
  514. but we only work with libidn 0.4.1 or later) */
  515. #define USE_LIBIDN
  516. #endif
  517. #ifndef SIZEOF_TIME_T
  518. /* assume default size of time_t to be 32 bit */
  519. #define SIZEOF_TIME_T 4
  520. #endif
  521. #define LIBIDN_REQUIRED_VERSION "0.4.1"
  522. #if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_NSS) || \
  523. defined(USE_POLARSSL) || defined(USE_AXTLS) || \
  524. defined(USE_CYASSL) || defined(USE_SCHANNEL) || \
  525. defined(USE_DARWINSSL) || defined(USE_GSKIT)
  526. #define USE_SSL /* SSL support has been enabled */
  527. #endif
  528. /* Single point where USE_SPNEGO definition might be defined */
  529. #if !defined(CURL_DISABLE_CRYPTO_AUTH) && \
  530. (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
  531. #define USE_SPNEGO
  532. #endif
  533. /* Single point where USE_KERBEROS5 definition might be defined */
  534. #if !defined(CURL_DISABLE_CRYPTO_AUTH) && \
  535. (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
  536. #define USE_KERBEROS5
  537. #endif
  538. /* Single point where USE_NTLM definition might be defined */
  539. #if !defined(CURL_DISABLE_NTLM) && !defined(CURL_DISABLE_CRYPTO_AUTH)
  540. #if defined(USE_OPENSSL) || defined(USE_WINDOWS_SSPI) || \
  541. defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_DARWINSSL) || \
  542. defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO)
  543. #ifdef HAVE_BORINGSSL /* BoringSSL is not NTLM capable */
  544. #undef USE_NTLM
  545. #else
  546. #define USE_NTLM
  547. #endif
  548. #endif
  549. #endif
  550. /* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */
  551. #if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)
  552. #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
  553. #endif
  554. /*
  555. * Provide a mechanism to silence picky compilers, such as gcc 4.6+.
  556. * Parameters should of course normally not be unused, but for example when
  557. * we have multiple implementations of the same interface it may happen.
  558. */
  559. #if defined(__GNUC__) && ((__GNUC__ >= 3) || \
  560. ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
  561. # define UNUSED_PARAM __attribute__((__unused__))
  562. # define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
  563. #else
  564. # define UNUSED_PARAM /*NOTHING*/
  565. # define WARN_UNUSED_RESULT
  566. #endif
  567. /*
  568. * Include macros and defines that should only be processed once.
  569. */
  570. #ifndef HEADER_CURL_SETUP_ONCE_H
  571. #include "curl_setup_once.h"
  572. #endif
  573. /*
  574. * Definition of our NOP statement Object-like macro
  575. */
  576. #ifndef Curl_nop_stmt
  577. # define Curl_nop_stmt do { } WHILE_FALSE
  578. #endif
  579. /*
  580. * Ensure that Winsock and lwIP TCP/IP stacks are not mixed.
  581. */
  582. #if defined(__LWIP_OPT_H__)
  583. # if defined(SOCKET) || \
  584. defined(USE_WINSOCK) || \
  585. defined(HAVE_WINSOCK_H) || \
  586. defined(HAVE_WINSOCK2_H) || \
  587. defined(HAVE_WS2TCPIP_H)
  588. # error "Winsock and lwIP TCP/IP stack definitions shall not coexist!"
  589. # endif
  590. #endif
  591. /*
  592. * Portable symbolic names for Winsock shutdown() mode flags.
  593. */
  594. #ifdef USE_WINSOCK
  595. # define SHUT_RD 0x00
  596. # define SHUT_WR 0x01
  597. # define SHUT_RDWR 0x02
  598. #endif
  599. /* Define S_ISREG if not defined by system headers, f.e. MSVC */
  600. #if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
  601. #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  602. #endif
  603. /* Define S_ISDIR if not defined by system headers, f.e. MSVC */
  604. #if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
  605. #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  606. #endif
  607. /* In Windows the default file mode is text but an application can override it.
  608. Therefore we specify it explicitly. https://github.com/bagder/curl/pull/258
  609. */
  610. #if defined(WIN32) || defined(MSDOS)
  611. #define FOPEN_READTEXT "rt"
  612. #define FOPEN_WRITETEXT "wt"
  613. #elif defined(__CYGWIN__)
  614. /* Cygwin has specific behavior we need to address when WIN32 is not defined.
  615. https://cygwin.com/cygwin-ug-net/using-textbinary.html
  616. For write we want our output to have line endings of LF and be compatible with
  617. other Cygwin utilities. For read we want to handle input that may have line
  618. endings either CRLF or LF so 't' is appropriate.
  619. */
  620. #define FOPEN_READTEXT "rt"
  621. #define FOPEN_WRITETEXT "w"
  622. #else
  623. #define FOPEN_READTEXT "r"
  624. #define FOPEN_WRITETEXT "w"
  625. #endif
  626. #endif /* HEADER_CURL_SETUP_H */