Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / lib / setup.h
blobf79a835f784ba2f2fb176c782cac59f49c8334bf
1 #ifndef __LIB_CURL_SETUP_H
2 #define __LIB_CURL_SETUP_H
3 /***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2008, 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.1.1.1 2008-09-23 16:32:05 hoffman Exp $
24 ***************************************************************************/
27 * Define WIN32 when build target is Win32 API
30 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && !defined(__SYMBIAN32__)
31 #define WIN32
32 #endif
35 * Include configuration script results or hand-crafted
36 * configuration file for platforms which lack config tool.
39 #ifdef HAVE_CONFIG_H
40 #include "config.h"
41 #else
43 #ifdef _WIN32_WCE
44 #include "config-win32ce.h"
45 #else
46 #ifdef WIN32
47 #include "config-win32.h"
48 #endif
49 #endif
51 #ifdef macintosh
52 #include "config-mac.h"
53 #endif
55 #ifdef __AMIGA__
56 #include "amigaos.h"
57 #endif
59 #ifdef __SYMBIAN32__
60 #include "config-symbian.h"
61 #endif
63 #ifdef __OS400__
64 # include "config-os400.h"
65 #endif
67 #ifdef TPF
68 #include "config-tpf.h" /* hand-modified TPF config.h */
69 /* change which select is used for libcurl */
70 #define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e)
71 #endif
73 #endif /* HAVE_CONFIG_H */
75 /* ================================================================ */
76 /* Definition of preprocessor macros/symbols which modify compiler */
77 /* behaviour or generated code characteristics must be done here, */
78 /* as appropriate, before any system header file is included. It is */
79 /* also possible to have them defined in the config file included */
80 /* before this point. As a result of all this we frown inclusion of */
81 /* system header files in our config files, avoid this at any cost. */
82 /* ================================================================ */
85 * Tru64 needs _REENTRANT set for a few function prototypes and
86 * things to appear in the system header files. Unixware needs it
87 * to build proper reentrant code. Others may also need it.
90 #ifdef NEED_REENTRANT
91 # ifndef _REENTRANT
92 # define _REENTRANT
93 # endif
94 #endif
96 /* ================================================================ */
97 /* If you need to include a system header file for your platform, */
98 /* please, do it beyond the point further indicated in this file. */
99 /* ================================================================ */
102 * libcurl's external interface definitions are also used internally,
103 * and might also include required system header files to define them.
106 #include <curl/curlbuild.h>
109 * Compile time sanity checks must also be done when building the library.
112 #include <curl/curlrules.h>
115 * Ensure that no one is using the old SIZEOF_CURL_OFF_T macro
118 #ifdef SIZEOF_CURL_OFF_T
119 # error "SIZEOF_CURL_OFF_T shall not be defined!"
120 Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined
121 #endif
124 * Set up internal curl_off_t formatting string directives for
125 * exclusive use with libcurl's internal *printf functions.
128 #ifdef FORMAT_OFF_T
129 # error "FORMAT_OFF_T shall not be defined before this point!"
130 Error Compilation_aborted_FORMAT_OFF_T_already_defined
131 #endif
133 #ifdef FORMAT_OFF_TU
134 # error "FORMAT_OFF_TU shall not be defined before this point!"
135 Error Compilation_aborted_FORMAT_OFF_TU_already_defined
136 #endif
138 #if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
139 # define FORMAT_OFF_T "lld"
140 # define FORMAT_OFF_TU "llu"
141 #else
142 # define FORMAT_OFF_T "ld"
143 # define FORMAT_OFF_TU "lu"
144 #endif
147 * Disable other protocols when http is the only one desired.
150 #ifdef HTTP_ONLY
151 # define CURL_DISABLE_TFTP
152 # define CURL_DISABLE_FTP
153 # define CURL_DISABLE_LDAP
154 # define CURL_DISABLE_TELNET
155 # define CURL_DISABLE_DICT
156 # define CURL_DISABLE_FILE
157 #endif
159 /* ================================================================ */
160 /* No system header file shall be included in this file before this */
161 /* point. The only allowed ones are those included from curlbuild.h */
162 /* ================================================================ */
165 * OS/400 setup file includes some system headers.
168 #ifdef __OS400__
169 # include "setup-os400.h"
170 #endif
173 * Include header files for windows builds before redefining anything.
174 * Use this preproessor block only to include or exclude windows.h,
175 * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
176 * to any other further and independant block. Under Cygwin things work
177 * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
178 * never be included when __CYGWIN__ is defined. configure script takes
179 * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
180 * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
183 #ifdef HAVE_WINDOWS_H
184 # ifndef WIN32_LEAN_AND_MEAN
185 # define WIN32_LEAN_AND_MEAN
186 # endif
187 # include <windows.h>
188 # ifdef HAVE_WINSOCK2_H
189 # include <winsock2.h>
190 # ifdef HAVE_WS2TCPIP_H
191 # include <ws2tcpip.h>
192 # endif
193 # else
194 # ifdef HAVE_WINSOCK_H
195 # include <winsock.h>
196 # endif
197 # endif
198 #endif
201 * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
202 * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
203 * undefine USE_WINSOCK.
206 #undef USE_WINSOCK
208 #ifdef HAVE_WINSOCK2_H
209 # define USE_WINSOCK 2
210 #else
211 # ifdef HAVE_WINSOCK_H
212 # define USE_WINSOCK 1
213 # endif
214 #endif
216 #ifdef HAVE_EXTRA_STRICMP_H
217 # include <extra/stricmp.h>
218 #endif
220 #ifdef HAVE_EXTRA_STRDUP_H
221 # include <extra/strdup.h>
222 #endif
224 #ifdef TPF
225 # include <strings.h> /* for bzero, strcasecmp, and strncasecmp */
226 # include <string.h> /* for strcpy and strlen */
227 # include <stdlib.h> /* for rand and srand */
228 # include <sys/socket.h> /* for select and ioctl*/
229 # include <netdb.h> /* for in_addr_t definition */
230 # include <tpf/sysapi.h> /* for tpf_process_signals */
231 #endif
233 #include <stdio.h>
234 #ifdef HAVE_ASSERT_H
235 #include <assert.h>
236 #endif
237 #include <errno.h>
239 #ifdef __TANDEM /* for nsr-tandem-nsk systems */
240 #include <floss.h>
241 #endif
243 #ifndef STDC_HEADERS /* no standard C headers! */
244 #include <curl/stdcheaders.h>
245 #endif
248 * PellesC kludge section (yikes);
249 * - It has 'ssize_t', but it is in <unistd.h>. The way the headers
250 * on Win32 are included, forces me to include this header here.
251 * - sys_nerr, EINTR is missing in v4.0 or older.
253 #ifdef __POCC__
254 #include <sys/types.h>
255 #include <unistd.h>
256 #if (__POCC__ <= 400)
257 #define sys_nerr EILSEQ /* for strerror.c */
258 #define EINTR -1 /* for select.c */
259 #endif
260 #endif
263 * Salford-C kludge section (mostly borrowed from wxWidgets).
265 #ifdef __SALFORDC__
266 #pragma suppress 353 /* Possible nested comments */
267 #pragma suppress 593 /* Define not used */
268 #pragma suppress 61 /* enum has no name */
269 #pragma suppress 106 /* unnamed, unused parameter */
270 #include <clib.h>
271 #endif
274 * Large file (>2Gb) support using WIN32 functions.
277 #ifdef USE_WIN32_LARGE_FILES
278 # include <io.h>
279 # include <sys/types.h>
280 # include <sys/stat.h>
281 # define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence)
282 # define fstat(fdes,stp) _fstati64(fdes, stp)
283 # define stat(fname,stp) _stati64(fname, stp)
284 # define struct_stat struct _stati64
285 #endif
288 * Small file (<2Gb) support using WIN32 functions.
291 #ifdef USE_WIN32_SMALL_FILES
292 # include <io.h>
293 # include <sys/types.h>
294 # include <sys/stat.h>
295 # define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
296 # define fstat(fdes,stp) _fstat(fdes, stp)
297 # define stat(fname,stp) _stat(fname, stp)
298 # define struct_stat struct _stat
299 #endif
301 #ifndef struct_stat
302 # define struct_stat struct stat
303 #endif
306 * Default sizeof(off_t) in case it hasn't been defined in config file.
309 #ifndef SIZEOF_OFF_T
310 # if defined(__VMS) && (defined(__alpha) || defined(__ia64))
311 # if defined(_LARGEFILE)
312 # define SIZEOF_OFF_T 8
313 # endif
314 # elif defined(__OS400__) && defined(__ILEC400__)
315 # if defined(_LARGE_FILES)
316 # define SIZEOF_OFF_T 8
317 # endif
318 # elif defined(__MVS__) && defined(__IBMC__)
319 # if defined(_LP64) || defined(_LARGE_FILES)
320 # define SIZEOF_OFF_T 8
321 # endif
322 # elif defined(__370__) && defined(__IBMC__)
323 # if defined(_LP64) || defined(_LARGE_FILES)
324 # define SIZEOF_OFF_T 8
325 # endif
326 # endif
327 # ifndef SIZEOF_OFF_T
328 # define SIZEOF_OFF_T 4
329 # endif
330 #endif
332 /* Below we define some functions. They should
333 1. close a socket
335 4. set the SIGALRM signal timeout
336 5. set dir/file naming defines
339 #ifdef WIN32
341 #if !defined(__CYGWIN__)
342 #define sclose(x) closesocket(x)
344 #undef HAVE_ALARM
345 #else
346 /* gcc-for-win is still good :) */
347 #define sclose(x) close(x)
348 #define HAVE_ALARM
349 #endif /* !GNU or mingw */
351 #define DIR_CHAR "\\"
352 #define DOT_CHAR "_"
354 #else /* WIN32 */
356 #ifdef MSDOS /* Watt-32 */
357 #include <sys/ioctl.h>
358 #define sclose(x) close_s(x)
359 #define select(n,r,w,x,t) select_s(n,r,w,x,t)
360 #define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
361 #define IOCTL_3_ARGS
362 #include <tcp.h>
363 #ifdef word
364 #undef word
365 #endif
366 #ifdef byte
367 #undef byte
368 #endif
370 #else /* MSDOS */
372 #ifdef __BEOS__
373 #define sclose(x) closesocket(x)
374 #else /* __BEOS__ */
375 #define sclose(x) close(x)
376 #endif /* __BEOS__ */
378 #define HAVE_ALARM
380 #endif /* MSDOS */
382 #ifdef _AMIGASF
383 #undef HAVE_ALARM
384 #undef sclose
385 #define sclose(x) CloseSocket(x)
386 #endif
388 #ifdef __minix
389 /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
390 extern char * strtok_r(char *s, const char *delim, char **last);
391 extern struct tm * gmtime_r(const time_t * const timep, struct tm *tmp);
392 #endif
394 #ifdef __SYMBIAN32__
395 #undef HAVE_ALARM
396 #endif
398 #define DIR_CHAR "/"
399 #ifndef DOT_CHAR
400 #define DOT_CHAR "."
401 #endif
403 #ifdef MSDOS
404 #undef DOT_CHAR
405 #define DOT_CHAR "_"
406 #endif
408 #ifndef fileno /* sunos 4 have this as a macro! */
409 int fileno( FILE *stream);
410 #endif
412 #endif /* WIN32 */
414 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(USE_ARES) && \
415 !defined(__LCC__) /* lcc-win32 doesn't have _beginthreadex() */
416 #ifdef ENABLE_IPV6
417 #define USE_THREADING_GETADDRINFO
418 #else
419 #define USE_THREADING_GETHOSTBYNAME /* Cygwin uses alarm() function */
420 #endif
421 #endif
423 /* "cl -ML" or "cl -MLd" implies a single-threaded runtime library where
424 _beginthreadex() is not available */
425 #if (defined(_MSC_VER) && !defined(__POCC__)) && !defined(_MT) && !defined(USE_ARES)
426 #undef USE_THREADING_GETADDRINFO
427 #undef USE_THREADING_GETHOSTBYNAME
428 #define CURL_NO__BEGINTHREADEX
429 #endif
432 * msvc 6.0 does not have struct sockaddr_storage and
433 * does not define IPPROTO_ESP in winsock2.h. But both
434 * are available if PSDK is properly installed.
437 #ifdef _MSC_VER
438 #if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))
439 #undef HAVE_STRUCT_SOCKADDR_STORAGE
440 #endif
441 #endif
443 #ifdef mpeix
444 #define IOCTL_3_ARGS
445 #endif
447 #ifdef NETWARE
448 int netware_init(void);
449 #ifndef __NOVELL_LIBC__
450 #include <sys/bsdskt.h>
451 #include <sys/timeval.h>
452 #endif
453 #undef HAVE_ALARM
454 #endif
456 #if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H)
457 /* The lib was present and the tld.h header (which is missing in libidn 0.3.X
458 but we only work with libidn 0.4.1 or later) */
459 #define USE_LIBIDN
460 #endif
462 #ifndef SIZEOF_TIME_T
463 /* assume default size of time_t to be 32 bit */
464 #define SIZEOF_TIME_T 4
465 #endif
467 #define LIBIDN_REQUIRED_VERSION "0.4.1"
469 #ifdef __UCLIBC__
470 #define HAVE_INET_NTOA_R_2_ARGS 1
471 #endif
473 #if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || defined(USE_QSOSSL)
474 #define USE_SSL /* SSL support has been enabled */
475 #endif
477 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM)
478 #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
479 #define USE_NTLM
480 #endif
481 #endif
483 /* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */
484 #if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)
485 #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
486 #endif
489 * Include macros and defines that should only be processed once.
492 #ifndef __SETUP_ONCE_H
493 #include "setup_once.h"
494 #endif
496 #endif /* __LIB_CURL_SETUP_H */