]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/curl/lib/setup.h
hello world
[icculus/iodoom3.git] / neo / curl / lib / setup.h
1 #ifndef __SETUP_H
2 #define __SETUP_H
3 /***************************************************************************
4  *                                  _   _ ____  _     
5  *  Project                     ___| | | |  _ \| |    
6  *                             / __| | | | |_) | |    
7  *                            | (__| |_| |  _ <| |___ 
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2004, 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 http://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  * $Id: setup.h,v 1.59 2004/03/17 12:46:46 bagder Exp $
24  ***************************************************************************/
25
26 #ifdef HTTP_ONLY
27 #define CURL_DISABLE_FTP
28 #define CURL_DISABLE_LDAP
29 #define CURL_DISABLE_TELNET
30 #define CURL_DISABLE_DICT
31 #define CURL_DISABLE_FILE
32 #define CURL_DISABLE_GOPHER
33 #endif
34
35 #if !defined(WIN32) && defined(__WIN32__)
36 /* This should be a good Borland fix. Alexander J. Oss told us! */
37 #define WIN32
38 #endif
39
40 #ifdef HAVE_CONFIG_H
41 #include "config.h" /* the configure script results */
42 #else
43 #ifdef WIN32
44 /* hand-modified win32 config.h! */
45 #include "config-win32.h"
46 #endif
47 #endif
48
49 #ifdef VMS
50 /* hand-modified VMS config.h! */
51 #include "config-vms.h"
52 #endif
53 #ifdef NETWARE
54 /* hand-modified NetWare config.h! */
55 #include "config-netware.h"
56 #endif
57 #ifdef macintosh
58 /* hand-modified MacOS config.h! */
59 #include "config-mac.h"
60 #endif
61 #ifdef AMIGA
62 /* hand-modified AmigaOS config.h! */
63 #include "amigaos.h"
64 #endif
65
66 #ifndef TRUE
67 #define TRUE 1
68 #endif
69 #ifndef FALSE
70 #define FALSE 0
71 #endif
72
73 #if !defined(__cplusplus) && !defined(__BEOS__)
74 typedef unsigned char bool;
75 #define typedef_bool
76 #endif
77
78 #ifdef HAVE_LONGLONG
79 #define LONG_LONG long long
80 #define ENABLE_64BIT
81 #else
82 #ifdef _MSC_VER
83 #define LONG_LONG __int64
84 #define ENABLE_64BIT
85 #endif
86 #endif /* HAVE_LONGLONG */
87
88 #ifndef SIZEOF_CURL_OFF_T
89 /* If we don't know the size here, we assume a conservative size: 4. When
90    building libcurl, the actual size of this variable should be define in the
91    config*.h file. */
92 #define SIZEOF_CURL_OFF_T 4
93 #endif
94
95 /* We set up our internal prefered (CURL_)FORMAT_OFF_T here */
96 #if SIZEOF_CURL_OFF_T > 4
97 #define FORMAT_OFF_T "lld"
98 #else
99 #define FORMAT_OFF_T "ld"
100 #endif
101
102 #ifdef NEED_REENTRANT
103 /* Solaris machines needs _REENTRANT set for a few function prototypes and
104    things to appear in the #include files. We need to #define it before all
105    #include files */
106 #define _REENTRANT
107 #endif
108
109 #include <stdio.h>
110 #ifdef HAVE_ASSERT_H
111 #include <assert.h>
112 #endif
113 #include <errno.h>
114
115 #ifdef __TANDEM /* for nsr-tandem-nsk systems */
116 #include <floss.h>
117 #endif
118
119 #if defined(HAVE_X509_H) && defined(HAVE_SSL_H) && defined(HAVE_RSA_H) && \
120 defined(HAVE_PEM_H) && defined(HAVE_ERR_H) && defined(HAVE_CRYPTO_H) && \
121 defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
122   /* the six important includes files all exist and so do both libs,
123      defined SSLeay usage */
124 #define USE_SSLEAY 1
125 #endif
126 #if defined(HAVE_OPENSSL_X509_H) && defined(HAVE_OPENSSL_SSL_H) && \
127 defined(HAVE_OPENSSL_RSA_H) && defined(HAVE_OPENSSL_PEM_H) && \
128 defined(HAVE_OPENSSL_ERR_H) && defined(HAVE_OPENSSL_CRYPTO_H) && \
129 defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
130   /* the six important includes files all exist and so do both libs,
131      defined SSLeay usage */
132 #define USE_SSLEAY 1
133 #define USE_OPENSSL 1
134 #endif
135
136 #ifndef STDC_HEADERS /* no standard C headers! */
137 #ifdef  VMS
138 #include "../include/curl/stdcheaders.h"
139 #else
140 #include <curl/stdcheaders.h>
141 #endif
142 #endif
143
144 #if defined(CURLDEBUG) && defined(HAVE_ASSERT_H)
145 #define NDEBUG
146 #define curlassert(x) assert(x)
147 #else
148 /* does nothing without CURLDEBUG defined */
149 #define curlassert(x)
150 #endif
151
152 #ifdef MSG_NOSIGNAL
153 /* If we have the MSG_NOSIGNAL define, we make sure to use that in the forth
154    argument to send() and recv() */
155 #define SEND_4TH_ARG MSG_NOSIGNAL
156 #define HAVE_MSG_NOSIGNAL 1 /* we have MSG_NOSIGNAL */
157 #else
158 #define SEND_4TH_ARG 0
159 #endif
160
161
162 /* Below we define four functions. They should
163    1. close a socket
164    2. read from a socket
165    3. write to a socket
166
167    4. set the SIGALRM signal timeout
168    5. set dir/file naming defines
169    */
170
171 #ifdef WIN32
172
173 #ifndef WIN32_LEAN_AND_MEAN
174 #define WIN32_LEAN_AND_MEAN  /* Prevent including <winsock*.h> in <windows.h> */
175 #endif
176
177 #include <winsock2.h>        /* required by telnet.c */
178
179 #if defined(ENABLE_IPV6) || defined(USE_SSLEAY)
180 #include <ws2tcpip.h>
181 #endif
182
183 #if !defined(__GNUC__) || defined(__MINGW32__)
184 #define sclose(x) closesocket(x)
185 #define sread(x,y,z) recv(x,y,z, SEND_4TH_ARG)
186 #define swrite(x,y,z) (size_t)send(x,y,z, SEND_4TH_ARG)
187 #undef HAVE_ALARM
188 #else
189      /* gcc-for-win is still good :) */
190 #define sclose(x) close(x)
191 #define sread(x,y,z) recv(x,y,z, SEND_4TH_ARG)
192 #define swrite(x,y,z) send(x,y,z, SEND_4TH_ARG)
193 #define HAVE_ALARM
194 #endif
195
196 #define DIR_CHAR      "\\"
197 #define DOT_CHAR      "_"
198
199 #else
200
201 #ifdef DJGPP
202 #define sclose(x)         close_s(x)
203 #define sread(x,y,z)      read_s(x,y,z)
204 #define swrite(x,y,z)     write_s(x,y,z)
205 #define select(n,r,w,x,t) select_s(n,r,w,x,t)
206 #define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
207 #define IOCTL_3_ARGS
208 #include <tcp.h>
209 #ifdef word
210 #undef word
211 #endif
212
213 #else
214
215 #ifdef __BEOS__
216 #define sclose(x) closesocket(x)
217 #define sread(x,y,z) (ssize_t)recv(x,y,z, SEND_4TH_ARG)
218 #define swrite(x,y,z) (ssize_t)send(x,y,z, SEND_4TH_ARG)
219 #else
220 #define sclose(x) close(x)
221 #define sread(x,y,z) recv(x,y,z, SEND_4TH_ARG)
222 #define swrite(x,y,z) send(x,y,z, SEND_4TH_ARG)
223 #endif
224
225 #define HAVE_ALARM
226
227 #endif
228
229 #ifdef _AMIGASF
230 #undef HAVE_ALARM
231 #undef sclose
232 #define sclose(x) CloseSocket(x)
233 #endif
234
235 #define DIR_CHAR      "/"
236 #define DOT_CHAR      "."
237
238 #ifdef DJGPP
239 #undef DOT_CHAR
240 #define DOT_CHAR      "_"
241 #endif
242
243 #ifndef fileno /* sunos 4 have this as a macro! */
244 int fileno( FILE *stream);
245 #endif
246
247 #endif
248
249 /* now typedef our socket type */
250 #ifdef WIN32
251 typedef SOCKET curl_socket_t;
252 #define CURL_SOCKET_BAD INVALID_SOCKET
253 #else
254 typedef int curl_socket_t;
255 #define CURL_SOCKET_BAD -1
256 #endif
257
258 #if defined(ENABLE_IPV6) && defined(USE_ARES)
259 #error "ares does not yet support IPv6. Disable IPv6 or ares and rebuild"
260 #endif
261
262 #if defined(WIN32) && !defined(__CYGWIN32__) && !defined(USE_ARES) && !defined(ENABLE_IPV6)
263 #define USE_THREADING_GETHOSTBYNAME  /* Cygwin uses alarm() function */
264 #endif
265
266 /*
267  * Curl_addrinfo MUST be used for name resolving information.
268  * Information regarding a single IP witin a Curl_addrinfo MUST be stored in
269  * a Curl_ipconnect struct.
270  */
271 #ifdef ENABLE_IPV6
272 typedef struct addrinfo Curl_addrinfo;
273 typedef struct addrinfo Curl_ipconnect;
274 #else
275 typedef struct hostent Curl_addrinfo;
276 typedef struct in_addr Curl_ipconnect;
277 #endif
278
279 #ifdef VMS
280 #define IOCTL_3_ARGS
281 #endif
282
283 #ifdef mpeix
284 #define IOCTL_3_ARGS
285 #endif
286
287 #ifndef ECONNRESET
288 #ifdef WSAECONNRESET
289 #define ECONNRESET WSAECONNRESET
290 #else
291 /* This will effectively prevent the code from working in this particular
292    aspect, but it still compile fine! */
293 #define ECONNRESET 10000
294 #endif
295 #endif
296
297 #ifdef NETWARE
298 #undef HAVE_ALARM
299 #endif
300
301 #endif /* __CONFIG_H */