1 #ifndef __LIB_CURL_SETUP_H
2 #define __LIB_CURL_SETUP_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
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.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 * $Id: setup.h,v 1.3 2009-06-10 15:49:23 king Exp $
24 ***************************************************************************/
27 #define CURL_DISABLE_TFTP
28 #define CURL_DISABLE_FTP
29 #define CURL_DISABLE_LDAP
30 #define CURL_DISABLE_TELNET
31 #define CURL_DISABLE_DICT
32 #define CURL_DISABLE_FILE
33 #endif /* HTTP_ONLY */
35 #if !defined(WIN32) && defined(__WIN32__)
40 #if !defined(WIN32) && defined(_WIN32)
41 /* VS2005 on x64 fix */
46 * Include configuration script results or hand-crafted
47 * configuration file for platforms which lack config tool.
56 #include "config-win32ce.h"
59 #include "config-win32.h"
65 #include "config-mac.h"
73 #include "config-tpf.h" /* hand-modified TPF config.h */
74 /* change which select is used for libcurl */
75 #define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e)
78 #endif /* HAVE_CONFIG_H */
81 * Include header files for windows builds before redefining anything.
82 * Use this preproessor block only to include or exclude windows.h,
83 * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
84 * to any other further and independant block. Under Cygwin things work
85 * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
86 * never be included when __CYGWIN__ is defined. configure script takes
87 * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
88 * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
92 # ifndef WIN32_LEAN_AND_MEAN
93 # define WIN32_LEAN_AND_MEAN
96 # ifdef HAVE_WINSOCK2_H
97 # include <winsock2.h>
98 # ifdef HAVE_WS2TCPIP_H
99 # include <ws2tcpip.h>
102 # ifdef HAVE_WINSOCK_H
103 # include <winsock.h>
109 * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
110 * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
111 * undefine USE_WINSOCK.
116 #ifdef HAVE_WINSOCK2_H
117 # define USE_WINSOCK 2
119 # ifdef HAVE_WINSOCK_H
120 # define USE_WINSOCK 1
132 #if !defined(__cplusplus) && !defined(__BEOS__) && !defined(__ECOS) && !defined(typedef_bool)
133 typedef unsigned char bool;
138 #define LONG_LONG long long
142 #define LONG_LONG __int64
144 #endif /* _MSC_VER */
145 #endif /* HAVE_LONGLONG */
147 #ifndef SIZEOF_CURL_OFF_T
148 /* If we don't know the size here, we assume a conservative size: 4. When
149 building libcurl, the actual size of this variable should be define in the
151 #define SIZEOF_CURL_OFF_T 4
154 /* We set up our internal prefered (CURL_)FORMAT_OFF_T here */
155 #if SIZEOF_CURL_OFF_T > 4
156 #define FORMAT_OFF_T "lld"
158 #define FORMAT_OFF_T "ld"
159 #endif /* SIZEOF_CURL_OFF_T */
162 /* Solaris needs _REENTRANT set for a few function prototypes and things to
163 appear in the #include files. We need to #define it before all #include
164 files. Unixware needs it to build proper reentrant code. Others may also
175 #ifdef __TANDEM /* for nsr-tandem-nsk systems */
179 #ifndef STDC_HEADERS /* no standard C headers! */
180 #include <curl/stdcheaders.h>
184 * PellesC cludge section (yikes);
185 * - It has 'ssize_t', but it is in <unistd.h>. The way the headers
186 * on Win32 are included, forces me to include this header here.
187 * - sys_nerr, EINTR is missing in v4.0 or older.
190 #include <sys/types.h>
192 #if (__POCC__ <= 400)
193 #define sys_nerr EILSEQ /* for strerror.c */
194 #define EINTR -1 /* for select.c */
199 * Salford-C cludge section (mostly borrowed from wxWidgets).
202 #pragma suppress 353 /* Possible nested comments */
203 #pragma suppress 593 /* Define not used */
204 #pragma suppress 61 /* enum has no name */
205 #pragma suppress 106 /* unnamed, unused parameter */
209 #if defined(CURLDEBUG) && defined(HAVE_ASSERT_H)
210 #define curlassert(x) assert(x)
212 /* does nothing without CURLDEBUG defined */
213 #define curlassert(x)
217 /* To make large file support transparent even on Windows */
218 #if defined(WIN32) && (SIZEOF_CURL_OFF_T > 4)
219 #include <sys/stat.h> /* must come first before we redefine stat() */
221 #define lseek(x,y,z) _lseeki64(x, y, z)
222 #define struct_stat struct _stati64
223 #define stat(file,st) _stati64(file,st)
224 #define fstat(fd,st) _fstati64(fd,st)
226 #define struct_stat struct stat
227 #endif /* Win32 with large file support */
230 /* Below we define some functions. They should
233 4. set the SIGALRM signal timeout
234 5. set dir/file naming defines
239 #if !defined(__CYGWIN__)
240 #define sclose(x) closesocket(x)
244 /* gcc-for-win is still good :) */
245 #define sclose(x) close(x)
247 #endif /* !GNU or mingw */
249 #define DIR_CHAR "\\"
254 #ifdef MSDOS /* Watt-32 */
255 #include <sys/ioctl.h>
256 #define sclose(x) close_s(x)
257 #define select(n,r,w,x,t) select_s(n,r,w,x,t)
258 #define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
268 #define IOCTL_3_ARGS 1
272 #define sclose(x) closesocket(x)
274 #define sclose(x) close(x)
275 #endif /* __BEOS__ */
284 #define sclose(x) CloseSocket(x)
297 #ifndef fileno /* sunos 4 have this as a macro! */
298 int fileno( FILE *stream
);
303 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(USE_ARES) && \
304 !defined(__LCC__) /* lcc-win32 doesn't have _beginthreadex() */
306 #define USE_THREADING_GETADDRINFO
308 #define USE_THREADING_GETHOSTBYNAME /* Cygwin uses alarm() function */
312 /* "cl -ML" or "cl -MLd" implies a single-threaded runtime library where
313 _beginthreadex() is not available */
314 #if (defined(_MSC_VER) && !defined(__POCC__)) && !defined(_MT) && !defined(USE_ARES)
315 #undef USE_THREADING_GETADDRINFO
316 #undef USE_THREADING_GETHOSTBYNAME
317 #define CURL_NO__BEGINTHREADEX
321 * msvc 6.0 does not have struct sockaddr_storage and
322 * does not define IPPROTO_ESP in winsock2.h. But both
323 * are available if PSDK is properly installed.
327 #if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))
328 #undef HAVE_STRUCT_SOCKADDR_STORAGE
340 #if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H)
341 /* The lib was present and the tld.h header (which is missing in libidn 0.3.X
342 but we only work with libidn 0.4.1 or later) */
346 #ifndef SIZEOF_TIME_T
347 /* assume default size of time_t to be 32 bit */
348 #define SIZEOF_TIME_T 4
351 #define LIBIDN_REQUIRED_VERSION "0.4.1"
354 #define HAVE_INET_NTOA_R_2_ARGS 1
357 #if defined(USE_GNUTLS) || defined(USE_SSLEAY)
358 #define USE_SSL /* Either OpenSSL || GnuTLS */
361 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM)
362 #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
373 /* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */
374 #if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)
375 #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
379 * Include macros and defines that should only be processed once.
382 #ifndef __SETUP_ONCE_H
383 #include "setup_once.h"
386 #endif /* __LIB_CURL_SETUP_H */