"Fossies" - the Fresh Open Source Software Archive

Member "curl-7.66.0/lib/curl_setup.h" (9 Sep 2019, 22059 Bytes) of package /linux/www/curl-7.66.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "curl_setup.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 7.65.3_vs_7.66.0.

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