00001 #ifndef HEADER_CURL_SETUP_H
00002 #define HEADER_CURL_SETUP_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && \
00030 !defined(__SYMBIAN32__)
00031 #define WIN32
00032 #endif
00033
00034
00035
00036
00037
00038
00039 #ifdef HAVE_CONFIG_H
00040
00041 #include "curl_config.h"
00042
00043 #else
00044
00045 #ifdef _WIN32_WCE
00046 # include "config-win32ce.h"
00047 #else
00048 # ifdef WIN32
00049 # include "config-win32.h"
00050 # endif
00051 #endif
00052
00053 #if defined(macintosh) && defined(__MRC__)
00054 # include "config-mac.h"
00055 #endif
00056
00057 #ifdef __riscos__
00058 # include "config-riscos.h"
00059 #endif
00060
00061 #ifdef __AMIGA__
00062 # include "config-amigaos.h"
00063 #endif
00064
00065 #ifdef __SYMBIAN32__
00066 # include "config-symbian.h"
00067 #endif
00068
00069 #ifdef __OS400__
00070 # include "config-os400.h"
00071 #endif
00072
00073 #ifdef TPF
00074 # include "config-tpf.h"
00075 #endif
00076
00077 #ifdef __VXWORKS__
00078 # include "config-vxworks.h"
00079 #endif
00080
00081 #endif
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 #ifdef NEED_THREAD_SAFE
00098 # ifndef _THREAD_SAFE
00099 # define _THREAD_SAFE
00100 # endif
00101 #endif
00102
00103
00104
00105
00106
00107
00108
00109 #ifdef NEED_REENTRANT
00110 # ifndef _REENTRANT
00111 # define _REENTRANT
00112 # endif
00113 #endif
00114
00115
00116 #if defined(sun) || defined(__sun)
00117 # ifndef _POSIX_PTHREAD_SEMANTICS
00118 # define _POSIX_PTHREAD_SEMANTICS 1
00119 # endif
00120 #endif
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 #include <curl/curlbuild.h>
00133
00134
00135
00136
00137
00138 #include <curl/curlrules.h>
00139
00140
00141
00142
00143
00144 #ifdef SIZEOF_CURL_OFF_T
00145 # error "SIZEOF_CURL_OFF_T shall not be defined!"
00146 Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined
00147 #endif
00148
00149
00150
00151
00152
00153 #ifdef HTTP_ONLY
00154 # ifndef CURL_DISABLE_TFTP
00155 # define CURL_DISABLE_TFTP
00156 # endif
00157 # ifndef CURL_DISABLE_FTP
00158 # define CURL_DISABLE_FTP
00159 # endif
00160 # ifndef CURL_DISABLE_LDAP
00161 # define CURL_DISABLE_LDAP
00162 # endif
00163 # ifndef CURL_DISABLE_TELNET
00164 # define CURL_DISABLE_TELNET
00165 # endif
00166 # ifndef CURL_DISABLE_DICT
00167 # define CURL_DISABLE_DICT
00168 # endif
00169 # ifndef CURL_DISABLE_FILE
00170 # define CURL_DISABLE_FILE
00171 # endif
00172 # ifndef CURL_DISABLE_RTSP
00173 # define CURL_DISABLE_RTSP
00174 # endif
00175 # ifndef CURL_DISABLE_POP3
00176 # define CURL_DISABLE_POP3
00177 # endif
00178 # ifndef CURL_DISABLE_IMAP
00179 # define CURL_DISABLE_IMAP
00180 # endif
00181 # ifndef CURL_DISABLE_SMTP
00182 # define CURL_DISABLE_SMTP
00183 # endif
00184 # ifndef CURL_DISABLE_RTMP
00185 # define CURL_DISABLE_RTMP
00186 # endif
00187 # ifndef CURL_DISABLE_GOPHER
00188 # define CURL_DISABLE_GOPHER
00189 # endif
00190 # ifndef CURL_DISABLE_SMB
00191 # define CURL_DISABLE_SMB
00192 # endif
00193 #endif
00194
00195
00196
00197
00198
00199 #if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP)
00200 # define CURL_DISABLE_RTSP
00201 #endif
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 #ifdef __OS400__
00213 # include "setup-os400.h"
00214 #endif
00215
00216
00217
00218
00219
00220 #ifdef __VMS
00221 # include "setup-vms.h"
00222 #endif
00223
00224
00225
00226
00227
00228
00229 #ifdef __APPLE__
00230 #define USE_RESOLVE_ON_IPS 1
00231 #endif
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244 #ifdef HAVE_WINDOWS_H
00245 # if defined(UNICODE) && !defined(_UNICODE)
00246 # define _UNICODE
00247 # endif
00248 # if defined(_UNICODE) && !defined(UNICODE)
00249 # define UNICODE
00250 # endif
00251 # ifndef WIN32_LEAN_AND_MEAN
00252 # define WIN32_LEAN_AND_MEAN
00253 # endif
00254 # include <windows.h>
00255 # ifdef HAVE_WINSOCK2_H
00256 # include <winsock2.h>
00257 # ifdef HAVE_WS2TCPIP_H
00258 # include <ws2tcpip.h>
00259 # endif
00260 # else
00261 # ifdef HAVE_WINSOCK_H
00262 # include <winsock.h>
00263 # endif
00264 # endif
00265 # include <tchar.h>
00266 # ifdef UNICODE
00267 typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
00268 # endif
00269 #endif
00270
00271
00272
00273
00274
00275
00276
00277 #undef USE_WINSOCK
00278
00279 #ifdef HAVE_WINSOCK2_H
00280 # define USE_WINSOCK 2
00281 #else
00282 # ifdef HAVE_WINSOCK_H
00283 # define USE_WINSOCK 1
00284 # endif
00285 #endif
00286
00287 #ifdef USE_LWIPSOCK
00288 # include <lwip/init.h>
00289 # include <lwip/sockets.h>
00290 # include <lwip/netdb.h>
00291 #endif
00292
00293 #ifdef HAVE_EXTRA_STRICMP_H
00294 # include <extra/stricmp.h>
00295 #endif
00296
00297 #ifdef HAVE_EXTRA_STRDUP_H
00298 # include <extra/strdup.h>
00299 #endif
00300
00301 #ifdef TPF
00302 # include <strings.h>
00303 # include <string.h>
00304 # include <stdlib.h>
00305 # include <sys/socket.h>
00306 # include <netdb.h>
00307 # include <tpf/sysapi.h>
00308
00309 # define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e)
00310 #endif
00311
00312 #ifdef __VXWORKS__
00313 # include <sockLib.h>
00314 # include <ioLib.h>
00315 #endif
00316
00317 #ifdef __AMIGA__
00318 # ifndef __ixemul__
00319 # include <exec/types.h>
00320 # include <exec/execbase.h>
00321 # include <proto/exec.h>
00322 # include <proto/dos.h>
00323 # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
00324 # endif
00325 #endif
00326
00327 #include <stdio.h>
00328 #ifdef HAVE_ASSERT_H
00329 #include <assert.h>
00330 #endif
00331
00332 #ifdef __TANDEM
00333 #include <floss.h>
00334 #endif
00335
00336 #ifndef STDC_HEADERS
00337 #include <curl/stdcheaders.h>
00338 #endif
00339
00340 #ifdef __POCC__
00341 # include <sys/types.h>
00342 # include <unistd.h>
00343 # define sys_nerr EILSEQ
00344 #endif
00345
00346
00347
00348
00349 #ifdef __SALFORDC__
00350 #pragma suppress 353
00351 #pragma suppress 593
00352 #pragma suppress 61
00353 #pragma suppress 106
00354 #include <clib.h>
00355 #endif
00356
00357
00358
00359
00360
00361 #ifdef USE_WIN32_LARGE_FILES
00362 # include <io.h>
00363 # include <sys/types.h>
00364 # include <sys/stat.h>
00365 # undef lseek
00366 # define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence)
00367 # undef fstat
00368 # define fstat(fdes,stp) _fstati64(fdes, stp)
00369 # undef stat
00370 # define stat(fname,stp) _stati64(fname, stp)
00371 # define struct_stat struct _stati64
00372 # define LSEEK_ERROR (__int64)-1
00373 #endif
00374
00375
00376
00377
00378
00379 #ifdef USE_WIN32_SMALL_FILES
00380 # include <io.h>
00381 # include <sys/types.h>
00382 # include <sys/stat.h>
00383 # ifndef _WIN32_WCE
00384 # undef lseek
00385 # define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
00386 # define fstat(fdes,stp) _fstat(fdes, stp)
00387 # define stat(fname,stp) _stat(fname, stp)
00388 # define struct_stat struct _stat
00389 # endif
00390 # define LSEEK_ERROR (long)-1
00391 #endif
00392
00393 #ifndef struct_stat
00394 # define struct_stat struct stat
00395 #endif
00396
00397 #ifndef LSEEK_ERROR
00398 # define LSEEK_ERROR (off_t)-1
00399 #endif
00400
00401
00402
00403
00404
00405 #ifndef SIZEOF_OFF_T
00406 # if defined(__VMS) && !defined(__VAX)
00407 # if defined(_LARGEFILE)
00408 # define SIZEOF_OFF_T 8
00409 # endif
00410 # elif defined(__OS400__) && defined(__ILEC400__)
00411 # if defined(_LARGE_FILES)
00412 # define SIZEOF_OFF_T 8
00413 # endif
00414 # elif defined(__MVS__) && defined(__IBMC__)
00415 # if defined(_LP64) || defined(_LARGE_FILES)
00416 # define SIZEOF_OFF_T 8
00417 # endif
00418 # elif defined(__370__) && defined(__IBMC__)
00419 # if defined(_LP64) || defined(_LARGE_FILES)
00420 # define SIZEOF_OFF_T 8
00421 # endif
00422 # endif
00423 # ifndef SIZEOF_OFF_T
00424 # define SIZEOF_OFF_T 4
00425 # endif
00426 #endif
00427
00428
00429
00430
00431
00432 #ifndef GETHOSTNAME_TYPE_ARG2
00433 # ifdef USE_WINSOCK
00434 # define GETHOSTNAME_TYPE_ARG2 int
00435 # else
00436 # define GETHOSTNAME_TYPE_ARG2 size_t
00437 # endif
00438 #endif
00439
00440
00441
00442
00443
00444
00445
00446 #ifdef WIN32
00447
00448 # define DIR_CHAR "\\"
00449 # define DOT_CHAR "_"
00450
00451 #else
00452
00453 # ifdef MSDOS
00454
00455 # include <sys/ioctl.h>
00456 # define select(n,r,w,x,t) select_s(n,r,w,x,t)
00457 # define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
00458 # include <tcp.h>
00459 # ifdef word
00460 # undef word
00461 # endif
00462 # ifdef byte
00463 # undef byte
00464 # endif
00465
00466 # endif
00467
00468 # ifdef __minix
00469
00470 extern char *strtok_r(char *s, const char *delim, char **last);
00471 extern struct tm *gmtime_r(const time_t * const timep, struct tm *tmp);
00472 # endif
00473
00474 # define DIR_CHAR "/"
00475 # ifndef DOT_CHAR
00476 # define DOT_CHAR "."
00477 # endif
00478
00479 # ifdef MSDOS
00480 # undef DOT_CHAR
00481 # define DOT_CHAR "_"
00482 # endif
00483
00484 # ifndef fileno
00485 int fileno(FILE *stream);
00486 # endif
00487
00488 #endif
00489
00490
00491
00492
00493
00494
00495
00496 #if defined(_MSC_VER) && !defined(__POCC__) && !defined(USE_LWIPSOCK)
00497 # if !defined(HAVE_WS2TCPIP_H) || \
00498 ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN))
00499 # undef HAVE_GETADDRINFO_THREADSAFE
00500 # undef HAVE_FREEADDRINFO
00501 # undef HAVE_GETADDRINFO
00502 # undef HAVE_GETNAMEINFO
00503 # undef ENABLE_IPV6
00504 # endif
00505 #endif
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516 #if defined(__LCC__) && defined(WIN32)
00517 # undef USE_THREADS_POSIX
00518 # undef USE_THREADS_WIN32
00519 #endif
00520
00521
00522
00523
00524
00525
00526 #if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT)
00527 # undef USE_THREADS_POSIX
00528 # undef USE_THREADS_WIN32
00529 #endif
00530
00531
00532
00533
00534
00535 #ifdef USE_ARES
00536 # define CURLRES_ASYNCH
00537 # define CURLRES_ARES
00538
00539 # undef HAVE_GETADDRINFO
00540 # undef HAVE_FREEADDRINFO
00541 # undef HAVE_GETHOSTBYNAME
00542 #elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
00543 # define CURLRES_ASYNCH
00544 # define CURLRES_THREADED
00545 #else
00546 # define CURLRES_SYNCH
00547 #endif
00548
00549 #ifdef ENABLE_IPV6
00550 # define CURLRES_IPV6
00551 #else
00552 # define CURLRES_IPV4
00553 #endif
00554
00555
00556
00557
00558
00559
00560
00561 #if defined(USE_WINSOCK) && (USE_WINSOCK != 2)
00562 # define CURL_DISABLE_TELNET 1
00563 #endif
00564
00565
00566
00567
00568
00569
00570
00571 #if defined(_MSC_VER) && !defined(__POCC__)
00572 # if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))
00573 # undef HAVE_STRUCT_SOCKADDR_STORAGE
00574 # endif
00575 #endif
00576
00577
00578
00579
00580
00581
00582
00583 #if defined(_MSC_VER) && !defined(__POCC__)
00584 # if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_))
00585 # if !defined(ALLOW_MSVC6_WITHOUT_PSDK)
00586 # error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. \
00587 "Windows Server 2003 PSDK"
00588 # else
00589 # define CURL_DISABLE_LDAP 1
00590 # endif
00591 # endif
00592 #endif
00593
00594 #ifdef NETWARE
00595 int netware_init(void);
00596 #ifndef __NOVELL_LIBC__
00597 #include <sys/bsdskt.h>
00598 #include <sys/timeval.h>
00599 #endif
00600 #endif
00601
00602 #if defined(HAVE_LIBIDN2) && defined(HAVE_IDN2_H)
00603
00604 #define USE_LIBIDN2
00605 #endif
00606
00607 #ifndef SIZEOF_TIME_T
00608
00609 #define SIZEOF_TIME_T 4
00610 #endif
00611
00612 #define LIBIDN_REQUIRED_VERSION "0.4.1"
00613
00614 #if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_NSS) || \
00615 defined(USE_POLARSSL) || defined(USE_AXTLS) || defined(USE_MBEDTLS) || \
00616 defined(USE_CYASSL) || defined(USE_SCHANNEL) || \
00617 defined(USE_DARWINSSL) || defined(USE_GSKIT)
00618 #define USE_SSL
00619 #endif
00620
00621
00622 #if !defined(CURL_DISABLE_CRYPTO_AUTH) && \
00623 (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
00624 #define USE_SPNEGO
00625 #endif
00626
00627
00628 #if !defined(CURL_DISABLE_CRYPTO_AUTH) && \
00629 (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
00630 #define USE_KERBEROS5
00631 #endif
00632
00633
00634 #if !defined(CURL_DISABLE_NTLM) && !defined(CURL_DISABLE_CRYPTO_AUTH)
00635 #if defined(USE_OPENSSL) || defined(USE_WINDOWS_SSPI) || \
00636 defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_DARWINSSL) || \
00637 defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO)
00638
00639 #define USE_NTLM
00640
00641 #elif defined(USE_MBEDTLS)
00642 # include <mbedtls/md4.h>
00643 # if defined(MBEDTLS_MD4_C)
00644 #define USE_NTLM
00645 # endif
00646
00647 #endif
00648 #endif
00649
00650
00651 #if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)
00652 #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
00653 #endif
00654
00655
00656
00657
00658
00659
00660
00661 #if defined(__GNUC__) && ((__GNUC__ >= 3) || \
00662 ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
00663 # define UNUSED_PARAM __attribute__((__unused__))
00664 # define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
00665 #else
00666 # define UNUSED_PARAM
00667 # define WARN_UNUSED_RESULT
00668 #endif
00669
00670
00671
00672
00673
00674 #ifndef HEADER_CURL_SETUP_ONCE_H
00675 #include "curl_setup_once.h"
00676 #endif
00677
00678
00679
00680
00681
00682 #ifndef Curl_nop_stmt
00683 # define Curl_nop_stmt do { } WHILE_FALSE
00684 #endif
00685
00686
00687
00688
00689
00690 #if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H)
00691 # if defined(SOCKET) || \
00692 defined(USE_WINSOCK) || \
00693 defined(HAVE_WINSOCK_H) || \
00694 defined(HAVE_WINSOCK2_H) || \
00695 defined(HAVE_WS2TCPIP_H)
00696 # error "Winsock and lwIP TCP/IP stack definitions shall not coexist!"
00697 # endif
00698 #endif
00699
00700
00701
00702
00703
00704 #ifdef USE_WINSOCK
00705 # define SHUT_RD 0x00
00706 # define SHUT_WR 0x01
00707 # define SHUT_RDWR 0x02
00708 #endif
00709
00710
00711 #if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
00712 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
00713 #endif
00714
00715
00716 #if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
00717 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
00718 #endif
00719
00720
00721
00722
00723 #if defined(WIN32) || defined(MSDOS)
00724 #define FOPEN_READTEXT "rt"
00725 #define FOPEN_WRITETEXT "wt"
00726 #elif defined(__CYGWIN__)
00727
00728
00729
00730
00731
00732
00733 #define FOPEN_READTEXT "rt"
00734 #define FOPEN_WRITETEXT "w"
00735 #else
00736 #define FOPEN_READTEXT "r"
00737 #define FOPEN_WRITETEXT "w"
00738 #endif
00739
00740
00741
00742
00743
00744
00745 #if !defined(DONT_USE_RECV_BEFORE_SEND_WORKAROUND)
00746 # if defined(WIN32) || defined(__CYGWIN__)
00747 # define USE_RECV_BEFORE_SEND_WORKAROUND
00748 # endif
00749 #else
00750 # ifdef USE_RECV_BEFORE_SEND_WORKAROUND
00751 # undef USE_RECV_BEFORE_SEND_WORKAROUND
00752 # endif
00753 #endif
00754
00755
00756
00757 # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)
00758 # include <winapifamily.h>
00759 # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
00760 !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
00761 # define CURL_WINDOWS_APP
00762 # endif
00763 # endif
00764
00765 #endif