Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl / setup.h
blobc363aa321d612401e022bf49e0d02c1b31d6d9d2
1 #ifndef __LIB_CURL_SETUP_H
2 #define __LIB_CURL_SETUP_H
3 /***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
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.2 2007/03/15 19:22:13 andy Exp $
24 ***************************************************************************/
26 #ifdef HTTP_ONLY
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__)
36 /* Borland fix */
37 #define WIN32
38 #endif
40 #if !defined(WIN32) && defined(_WIN32)
41 /* VS2005 on x64 fix */
42 #define WIN32
43 #endif
46 * Include configuration script results or hand-crafted
47 * configuration file for platforms which lack config tool.
50 #ifdef HAVE_CONFIG_H
51 #include "config.h"
52 #else
55 #ifdef _WIN32_WCE
56 #include "config-win32ce.h"
57 #else
58 #ifdef WIN32
59 #include "config-win32.h"
60 #endif
61 #endif
64 #ifdef macintosh
65 #include "config-mac.h"
66 #endif
68 #ifdef AMIGA
69 #include "amigaos.h"
70 #endif
72 #ifdef TPF
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)
76 #endif
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.
91 #ifdef HAVE_WINDOWS_H
92 # ifndef WIN32_LEAN_AND_MEAN
93 # define WIN32_LEAN_AND_MEAN
94 # endif
95 # include <windows.h>
96 # ifdef HAVE_WINSOCK2_H
97 # include <winsock2.h>
98 # ifdef HAVE_WS2TCPIP_H
99 # include <ws2tcpip.h>
100 # endif
101 # else
102 # ifdef HAVE_WINSOCK_H
103 # include <winsock.h>
104 # endif
105 # endif
106 #endif
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.
114 #undef USE_WINSOCK
116 #ifdef HAVE_WINSOCK2_H
117 # define USE_WINSOCK 2
118 #else
119 # ifdef HAVE_WINSOCK_H
120 # define USE_WINSOCK 1
121 # endif
122 #endif
125 #ifndef TRUE
126 #define TRUE 1
127 #endif
128 #ifndef FALSE
129 #define FALSE 0
130 #endif
132 #if !defined(__cplusplus) && !defined(__BEOS__) && !defined(__ECOS) && !defined(typedef_bool)
133 typedef unsigned char bool;
134 #define typedef_bool
135 #endif
137 #ifdef HAVE_LONGLONG
138 #define LONG_LONG long long
139 #define ENABLE_64BIT
140 #else
141 #ifdef _MSC_VER
142 #define LONG_LONG __int64
143 #define ENABLE_64BIT
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
150 config*.h file. */
151 #define SIZEOF_CURL_OFF_T 4
152 #endif
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"
157 #else
158 #define FORMAT_OFF_T "ld"
159 #endif /* SIZEOF_CURL_OFF_T */
161 #ifndef _REENTRANT
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
165 need it. */
166 #define _REENTRANT
167 #endif
169 #include <stdio.h>
170 #ifdef HAVE_ASSERT_H
171 #include <assert.h>
172 #endif
173 #include <errno.h>
175 #ifdef __TANDEM /* for nsr-tandem-nsk systems */
176 #include <floss.h>
177 #endif
179 #ifndef STDC_HEADERS /* no standard C headers! */
180 #include <curl/stdcheaders.h>
181 #endif
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.
189 #ifdef __POCC__
190 #include <sys/types.h>
191 #include <unistd.h>
192 #if (__POCC__ <= 400)
193 #define sys_nerr EILSEQ /* for strerror.c */
194 #define EINTR -1 /* for select.c */
195 #endif
196 #endif
199 * Salford-C cludge section (mostly borrowed from wxWidgets).
201 #ifdef __SALFORDC__
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 */
206 #include <clib.h>
207 #endif
209 #if defined(CURLDEBUG) && defined(HAVE_ASSERT_H)
210 #define curlassert(x) assert(x)
211 #else
212 /* does nothing without CURLDEBUG defined */
213 #define curlassert(x)
214 #endif
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() */
220 #include <io.h>
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)
225 #else
226 #define struct_stat struct stat
227 #endif /* Win32 with large file support */
230 /* Below we define some functions. They should
231 1. close a socket
233 4. set the SIGALRM signal timeout
234 5. set dir/file naming defines
237 #ifdef WIN32
239 #if !defined(__CYGWIN__)
240 #define sclose(x) closesocket(x)
242 #undef HAVE_ALARM
243 #else
244 /* gcc-for-win is still good :) */
245 #define sclose(x) close(x)
246 #define HAVE_ALARM
247 #endif /* !GNU or mingw */
249 #define DIR_CHAR "\\"
250 #define DOT_CHAR "_"
252 #else /* WIN32 */
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))
259 #define IOCTL_3_ARGS
260 #include <tcp.h>
261 #ifdef word
262 #undef word
263 #endif
265 #else /* MSDOS */
267 #ifdef __BEOS__
268 #define sclose(x) closesocket(x)
269 #else /* __BEOS__ */
270 #define sclose(x) close(x)
271 #endif /* __BEOS__ */
273 #define HAVE_ALARM
275 #endif /* MSDOS */
277 #ifdef _AMIGASF
278 #undef HAVE_ALARM
279 #undef sclose
280 #define sclose(x) CloseSocket(x)
281 #endif
283 #define DIR_CHAR "/"
284 #ifndef DOT_CHAR
285 #define DOT_CHAR "."
286 #endif
288 #ifdef MSDOS
289 #undef DOT_CHAR
290 #define DOT_CHAR "_"
291 #endif
293 #ifndef fileno /* sunos 4 have this as a macro! */
294 int fileno( FILE *stream);
295 #endif
297 #endif /* WIN32 */
299 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(USE_ARES) && \
300 !defined(__LCC__) /* lcc-win32 doesn't have _beginthreadex() */
301 #ifdef ENABLE_IPV6
302 #define USE_THREADING_GETADDRINFO
303 #else
304 #define USE_THREADING_GETHOSTBYNAME /* Cygwin uses alarm() function */
305 #endif
306 #endif
308 /* "cl -ML" or "cl -MLd" implies a single-threaded runtime library where
309 _beginthreadex() is not available */
310 #if (defined(_MSC_VER) && !defined(__POCC__)) && !defined(_MT) && !defined(USE_ARES)
311 #undef USE_THREADING_GETADDRINFO
312 #undef USE_THREADING_GETHOSTBYNAME
313 #define CURL_NO__BEGINTHREADEX
314 #endif
317 * msvc 6.0 does not have struct sockaddr_storage and
318 * does not define IPPROTO_ESP in winsock2.h. But both
319 * are available if PSDK is properly installed.
322 #ifdef _MSC_VER
323 #if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))
324 #undef HAVE_STRUCT_SOCKADDR_STORAGE
325 #endif
326 #endif
328 #ifdef mpeix
329 #define IOCTL_3_ARGS
330 #endif
332 #ifdef NETWARE
333 #undef HAVE_ALARM
334 #endif
336 #if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H)
337 /* The lib was present and the tld.h header (which is missing in libidn 0.3.X
338 but we only work with libidn 0.4.1 or later) */
339 #define USE_LIBIDN
340 #endif
342 #ifndef SIZEOF_TIME_T
343 /* assume default size of time_t to be 32 bit */
344 #define SIZEOF_TIME_T 4
345 #endif
347 #define LIBIDN_REQUIRED_VERSION "0.4.1"
349 #ifdef __UCLIBC__
350 #define HAVE_INET_NTOA_R_2_ARGS 1
351 #endif
353 #if defined(USE_GNUTLS) || defined(USE_SSLEAY)
354 #define USE_SSL /* Either OpenSSL || GnuTLS */
355 #endif
357 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM)
358 #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
359 #define USE_NTLM
360 #endif
361 #endif
363 #ifdef CURLDEBUG
364 #define DEBUGF(x) x
365 #else
366 #define DEBUGF(x)
367 #endif
369 /* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */
370 #if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)
371 #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
372 #endif
375 * Include macros and defines that should only be processed once.
378 #ifndef __SETUP_ONCE_H
379 #include "setup_once.h"
380 #endif
382 #endif /* __LIB_CURL_SETUP_H */