36fde516fefa6f8b709daac083ec49634a13666c
[platform/upstream/curl.git] / src / setup.h
1 #ifndef __SRC_CURL_SETUP_H
2 #define __SRC_CURL_SETUP_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2009, 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$
24  ***************************************************************************/
25
26 #define CURL_NO_OLDIES
27
28 /*
29  * Define WIN32 when build target is Win32 API
30  */
31
32 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && !defined(__SYMBIAN32__)
33 #define WIN32
34 #endif
35
36 /*
37  * Include configuration script results or hand-crafted
38  * configuration file for platforms which lack config tool.
39  */
40
41 #ifdef HAVE_CONFIG_H
42 #include "curl_config.h"
43 #else
44
45 #ifdef WIN32
46 #include "config-win32.h"
47 #endif
48
49 #if defined(macintosh) && defined(__MRC__)
50 #  include "config-mac.h"
51 #endif
52
53 #ifdef __riscos__
54 #include "config-riscos.h"
55 #endif
56
57 #ifdef __AMIGA__
58 #include "config-amigaos.h"
59 #endif
60
61 #ifdef __SYMBIAN32__
62 #include "config-symbian.h"
63 #endif
64
65 #ifdef TPF
66 #include "config-tpf.h"
67 #endif
68
69 #endif /* HAVE_CONFIG_H */
70
71 /*
72  * AIX 4.3 and newer needs _THREAD_SAFE defined to build
73  * proper reentrant code. Others may also need it.
74  */
75
76 #ifdef NEED_THREAD_SAFE
77 #  ifndef _THREAD_SAFE
78 #    define _THREAD_SAFE
79 #  endif
80 #endif
81
82 /*
83  * Tru64 needs _REENTRANT set for a few function prototypes and
84  * things to appear in the system header files. Unixware needs it
85  * to build proper reentrant code. Others may also need it.
86  */
87
88 #ifdef NEED_REENTRANT
89 #  ifndef _REENTRANT
90 #    define _REENTRANT
91 #  endif
92 #endif
93
94 /* 
95  * Include header files for windows builds before redefining anything.
96  * Use this preproessor block only to include or exclude windows.h, 
97  * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs 
98  * to any other further and independent block.  Under Cygwin things work
99  * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
100  * never be included when __CYGWIN__ is defined.  configure script takes
101  * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
102  * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
103  */
104
105 #ifdef HAVE_WINDOWS_H
106 #  ifndef WIN32_LEAN_AND_MEAN
107 #    define WIN32_LEAN_AND_MEAN
108 #  endif
109 #  include <windows.h>
110 #  ifdef HAVE_WINSOCK2_H
111 #    include <winsock2.h>
112 #    ifdef HAVE_WS2TCPIP_H
113 #       include <ws2tcpip.h>
114 #    endif
115 #  else
116 #    ifdef HAVE_WINSOCK_H
117 #      include <winsock.h>
118 #    endif
119 #  endif
120 #endif
121
122 /*
123  * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
124  * define USE_WINSOCK to 1 if we have and use WINSOCK  API, else
125  * undefine USE_WINSOCK.
126  */
127
128 #undef USE_WINSOCK
129
130 #ifdef HAVE_WINSOCK2_H
131 #  define USE_WINSOCK 2
132 #else
133 #  ifdef HAVE_WINSOCK_H
134 #    define USE_WINSOCK 1
135 #  endif
136 #endif
137
138 #ifdef TPF
139 #  include <sys/socket.h>
140    /* change which select is used for the curl command line tool */
141 #  define select(a,b,c,d,e) tpf_select_bsd(a,b,c,d,e)
142    /* and turn off the progress meter */
143 #  define CONF_DEFAULT (0|CONF_NOPROGRESS)
144 #endif
145
146 #include <stdio.h>
147
148 #ifdef __TANDEM
149 #include <floss.h>
150 #endif
151
152
153 #ifndef OS
154 #define OS "unknown"
155 #endif
156
157 #if !defined(fileno) && !defined(WIN32) /* sunos 4 have this as a macro! */
158 int fileno( FILE *stream);
159 #endif
160
161 #ifdef WIN32
162 #define DIR_CHAR      "\\"
163 #define DOT_CHAR      "_"
164 #else
165 #ifdef __EMX__
166 /* 20000318 mgs
167  * OS/2 supports leading dots in filenames if the volume is formatted
168  * with JFS or HPFS. */
169 #define DIR_CHAR      "\\"
170 #define DOT_CHAR      "."
171 #else
172
173 #ifdef DJGPP
174 #include <tcp.h>
175 #ifdef word
176 #undef word
177 #endif
178 #define DIR_CHAR      "/"
179 #define DOT_CHAR      "_"
180 #else
181
182 #define DIR_CHAR      "/"
183 #define DOT_CHAR      "."
184
185 #endif /* !DJGPP */
186 #endif /* !__EMX__ */
187 #endif /* !WIN32 */
188
189 #ifdef __riscos__
190 #define USE_ENVIRONMENT
191 #endif
192
193 #ifdef __BEOS__
194 #define typedef_bool
195 #endif
196
197 #if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
198 #include <sys/timeval.h>
199 #endif
200
201 #ifndef UNPRINTABLE_CHAR
202 /* define what to use for unprintable characters */
203 #define UNPRINTABLE_CHAR '.'
204 #endif
205
206 #ifndef HAVE_STRDUP
207 #include "strdup.h"
208 #define strdup(ptr) curlx_strdup(ptr)
209 #endif
210
211 /*
212  * Include macros and defines that should only be processed once.
213  */
214
215 #ifndef __SETUP_ONCE_H
216 #include "setup_once.h"
217 #endif
218
219 #endif /* __SRC_CURL_SETUP_H */