Annotation of embedaddon/curl/lib/curl_setup.h, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>