1 #ifndef __LIB_CURL_SETUP_H
2 #define __LIB_CURL_SETUP_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
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.
24 ***************************************************************************/
27 * Define WIN32 when build target is Win32 API
30 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && !defined(__SYMBIAN32__)
35 * Include configuration script results or hand-crafted
36 * configuration file for platforms which lack config tool.
44 #include "config-win32ce.h"
47 #include "config-win32.h"
52 #include "config-mac.h"
60 #include "config-symbian.h"
64 # include "config-os400.h"
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)
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.
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
124 * Ensure that no one is using the old internal FORMAT_OFF_T macro
128 # error "FORMAT_OFF_T shall not be defined!"
129 Error Compilation_aborted_FORMAT_OFF_T_shall_not_be_defined
133 * Ensure that no one is using the old internal FORMAT_OFF_TU macro
137 # error "FORMAT_OFF_TU shall not be defined!"
138 Error Compilation_aborted_FORMAT_OFF_TU_shall_not_be_defined
142 * Disable other protocols when http is the only one desired.
146 # define CURL_DISABLE_TFTP
147 # define CURL_DISABLE_FTP
148 # define CURL_DISABLE_LDAP
149 # define CURL_DISABLE_TELNET
150 # define CURL_DISABLE_DICT
151 # define CURL_DISABLE_FILE
154 /* ================================================================ */
155 /* No system header file shall be included in this file before this */
156 /* point. The only allowed ones are those included from curlbuild.h */
157 /* ================================================================ */
160 * OS/400 setup file includes some system headers.
164 # include "setup-os400.h"
168 * Include header files for windows builds before redefining anything.
169 * Use this preproessor block only to include or exclude windows.h,
170 * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
171 * to any other further and independant block. Under Cygwin things work
172 * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
173 * never be included when __CYGWIN__ is defined. configure script takes
174 * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
175 * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
178 #ifdef HAVE_WINDOWS_H
179 # ifndef WIN32_LEAN_AND_MEAN
180 # define WIN32_LEAN_AND_MEAN
182 # include <windows.h>
183 # ifdef HAVE_WINSOCK2_H
184 # include <winsock2.h>
185 # ifdef HAVE_WS2TCPIP_H
186 # include <ws2tcpip.h>
189 # ifdef HAVE_WINSOCK_H
190 # include <winsock.h>
196 * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
197 * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
198 * undefine USE_WINSOCK.
203 #ifdef HAVE_WINSOCK2_H
204 # define USE_WINSOCK 2
206 # ifdef HAVE_WINSOCK_H
207 # define USE_WINSOCK 1
213 #define LONG_LONG long long
217 #define LONG_LONG __int64
219 #endif /* _MSC_VER */
220 #endif /* HAVE_LONGLONG */
222 #ifdef HAVE_EXTRA_STRICMP_H
223 # include <extra/stricmp.h>
226 #ifdef HAVE_EXTRA_STRDUP_H
227 # include <extra/strdup.h>
231 # include <strings.h> /* for bzero, strcasecmp, and strncasecmp */
232 # include <string.h> /* for strcpy and strlen */
233 # include <stdlib.h> /* for rand and srand */
234 # include <sys/socket.h> /* for select and ioctl*/
235 # include <netdb.h> /* for in_addr_t definition */
236 # include <tpf/sysapi.h> /* for tpf_process_signals */
245 #ifdef __TANDEM /* for nsr-tandem-nsk systems */
249 #ifndef STDC_HEADERS /* no standard C headers! */
250 #include <curl/stdcheaders.h>
254 * PellesC kludge section (yikes);
255 * - It has 'ssize_t', but it is in <unistd.h>. The way the headers
256 * on Win32 are included, forces me to include this header here.
257 * - sys_nerr, EINTR is missing in v4.0 or older.
260 #include <sys/types.h>
262 #if (__POCC__ <= 400)
263 #define sys_nerr EILSEQ /* for strerror.c */
264 #define EINTR -1 /* for select.c */
269 * Salford-C kludge section (mostly borrowed from wxWidgets).
272 #pragma suppress 353 /* Possible nested comments */
273 #pragma suppress 593 /* Define not used */
274 #pragma suppress 61 /* enum has no name */
275 #pragma suppress 106 /* unnamed, unused parameter */
280 /* To make large file support transparent even on Windows */
281 #if defined(WIN32) && (CURL_SIZEOF_CURL_OFF_T > 4)
282 #include <sys/stat.h> /* must come first before we redefine stat() */
284 #define lseek(x,y,z) _lseeki64(x, y, z)
285 #define struct_stat struct _stati64
286 #define stat(file,st) _stati64(file,st)
287 #define fstat(fd,st) _fstati64(fd,st)
289 #define struct_stat struct stat
290 #endif /* Win32 with large file support */
293 /* Below we define some functions. They should
296 4. set the SIGALRM signal timeout
297 5. set dir/file naming defines
302 #if !defined(__CYGWIN__)
303 #define sclose(x) closesocket(x)
307 /* gcc-for-win is still good :) */
308 #define sclose(x) close(x)
310 #endif /* !GNU or mingw */
312 #define DIR_CHAR "\\"
317 #ifdef MSDOS /* Watt-32 */
318 #include <sys/ioctl.h>
319 #define sclose(x) close_s(x)
320 #define select(n,r,w,x,t) select_s(n,r,w,x,t)
321 #define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
334 #define sclose(x) closesocket(x)
336 #define sclose(x) close(x)
337 #endif /* __BEOS__ */
346 #define sclose(x) CloseSocket(x)
350 /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
351 extern char * strtok_r(char *s, const char *delim, char **last);
352 extern struct tm * gmtime_r(const time_t * const timep, struct tm *tmp);
369 #ifndef fileno /* sunos 4 have this as a macro! */
370 int fileno( FILE *stream);
375 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(USE_ARES) && \
376 !defined(__LCC__) /* lcc-win32 doesn't have _beginthreadex() */
378 #define USE_THREADING_GETADDRINFO
380 #define USE_THREADING_GETHOSTBYNAME /* Cygwin uses alarm() function */
384 /* "cl -ML" or "cl -MLd" implies a single-threaded runtime library where
385 _beginthreadex() is not available */
386 #if (defined(_MSC_VER) && !defined(__POCC__)) && !defined(_MT) && !defined(USE_ARES)
387 #undef USE_THREADING_GETADDRINFO
388 #undef USE_THREADING_GETHOSTBYNAME
389 #define CURL_NO__BEGINTHREADEX
393 * msvc 6.0 does not have struct sockaddr_storage and
394 * does not define IPPROTO_ESP in winsock2.h. But both
395 * are available if PSDK is properly installed.
399 #if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))
400 #undef HAVE_STRUCT_SOCKADDR_STORAGE
409 int netware_init(void);
410 #ifndef __NOVELL_LIBC__
411 #include <sys/bsdskt.h>
412 #include <sys/timeval.h>
417 #if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H)
418 /* The lib was present and the tld.h header (which is missing in libidn 0.3.X
419 but we only work with libidn 0.4.1 or later) */
423 #ifndef SIZEOF_TIME_T
424 /* assume default size of time_t to be 32 bit */
425 #define SIZEOF_TIME_T 4
428 #define LIBIDN_REQUIRED_VERSION "0.4.1"
431 #define HAVE_INET_NTOA_R_2_ARGS 1
434 #if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || defined(USE_QSOSSL)
435 #define USE_SSL /* SSL support has been enabled */
438 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM)
439 #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
444 /* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */
445 #if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)
446 #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
450 * Include macros and defines that should only be processed once.
453 #ifndef __SETUP_ONCE_H
454 #include "setup_once.h"
457 #endif /* __LIB_CURL_SETUP_H */