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