Fix spelling
[platform/upstream/c-ares.git] / setup.h
1 #ifndef __ARES_SETUP_H
2 #define __ARES_SETUP_H
3
4 /* $Id$ */
5
6 /* Copyright (C) 2004 - 2009 by Daniel Stenberg et al
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation for any purpose and without fee is hereby granted, provided
10  * that the above copyright notice appear in all copies and that both that
11  * copyright notice and this permission notice appear in supporting
12  * documentation, and that the name of M.I.T. not be used in advertising or
13  * publicity pertaining to distribution of the software without specific,
14  * written prior permission.  M.I.T. makes no representations about the
15  * suitability of this software for any purpose.  It is provided "as is"
16  * without express or implied warranty.
17  */
18
19 /*
20  * Define WIN32 when build target is Win32 API
21  */
22
23 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
24 #define WIN32
25 #endif
26
27 /*
28  * Include configuration script results or hand-crafted
29  * configuration file for platforms which lack config tool.
30  */
31
32 #ifdef HAVE_CONFIG_H
33 #include "ares_config.h"
34 #else
35
36 #ifdef WIN32
37 #include "config-win32.h"
38 #endif
39
40 #endif /* HAVE_CONFIG_H */
41
42 /* ================================================================ */
43 /* Definition of preprocessor macros/symbols which modify compiler  */
44 /* behaviour or generated code characteristics must be done here,   */
45 /* as appropriate, before any system header file is included. It is */
46 /* also possible to have them defined in the config file included   */
47 /* before this point. As a result of all this we frown inclusion of */
48 /* system header files in our config files, avoid this at any cost. */
49 /* ================================================================ */
50
51 /*
52  * Tru64 needs _REENTRANT set for a few function prototypes and
53  * things to appear in the system header files. Unixware needs it
54  * to build proper reentrant code. Others may also need it.
55  */
56
57 #ifdef NEED_REENTRANT
58 #  ifndef _REENTRANT
59 #    define _REENTRANT
60 #  endif
61 #endif
62
63 /* ================================================================ */
64 /*  If you need to include a system header file for your platform,  */
65 /*  please, do it beyond the point further indicated in this file.  */
66 /* ================================================================ */
67
68 /*
69  * c-ares external interface definitions are also used internally,
70  * and might also include required system header files to define them.
71  */
72
73 #include <ares_build.h>
74
75 /*
76  * Compile time sanity checks must also be done when building the library.
77  */
78
79 #include <ares_rules.h>
80
81 /* ================================================================ */
82 /* No system header file shall be included in this file before this */
83 /* point. The only allowed ones are those included from curlbuild.h */
84 /* ================================================================ */
85
86 /*
87  * Include header files for windows builds before redefining anything.
88  * Use this preproessor block only to include or exclude windows.h,
89  * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
90  * to any other further and independent block.  Under Cygwin things work
91  * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
92  * never be included when __CYGWIN__ is defined.  configure script takes
93  * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
94  * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
95  */
96
97 #ifdef HAVE_WINDOWS_H
98 #  ifndef WIN32_LEAN_AND_MEAN
99 #    define WIN32_LEAN_AND_MEAN
100 #  endif
101 #  include <windows.h>
102 #  ifdef HAVE_WINSOCK2_H
103 #    include <winsock2.h>
104 #    ifdef HAVE_WS2TCPIP_H
105 #       include <ws2tcpip.h>
106 #    endif
107 #  else
108 #    ifdef HAVE_WINSOCK_H
109 #      include <winsock.h>
110 #    endif
111 #  endif
112 #endif
113
114 /*
115  * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
116  * define USE_WINSOCK to 1 if we have and use WINSOCK  API, else
117  * undefine USE_WINSOCK.
118  */
119
120 #undef USE_WINSOCK
121
122 #ifdef HAVE_WINSOCK2_H
123 #  define USE_WINSOCK 2
124 #else
125 #  ifdef HAVE_WINSOCK_H
126 #    define USE_WINSOCK 1
127 #  endif
128 #endif
129
130 /*
131  * Work-arounds for systems without configure support
132  */
133
134 #ifndef HAVE_CONFIG_H
135
136 #if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__)
137 #define HAVE_SYS_TIME_H
138 #endif
139
140 #if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
141 #define HAVE_UNISTD_H 1
142 #endif
143
144 #if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
145 #define HAVE_SYS_UIO_H
146 #endif
147
148 #endif /* HAVE_CONFIG_H */
149
150 #ifdef __POCC__
151 #  include <sys/types.h>
152 #  include <unistd.h>
153 #  define ESRCH 3
154 #endif
155
156 /*
157  * Recent autoconf versions define these symbols in ares_config.h. We don't
158  * want them (since they collide with the libcurl ones when we build
159  *  --enable-debug) so we undef them again here.
160  */
161
162 #undef PACKAGE_STRING
163 #undef PACKAGE_TARNAME
164 #undef PACKAGE_VERSION
165 #undef PACKAGE_BUGREPORT
166 #undef PACKAGE_NAME
167 #undef VERSION
168 #undef PACKAGE
169
170 /* IPv6 compatibility */
171 #if !defined(HAVE_AF_INET6)
172 #if defined(HAVE_PF_INET6)
173 #define AF_INET6 PF_INET6
174 #else
175 #define AF_INET6 AF_MAX+1
176 #endif
177 #endif
178
179 /*
180  * Include macros and defines that should only be processed once.
181  */
182
183 #ifndef __SETUP_ONCE_H
184 #include "setup_once.h"
185 #endif
186
187 #endif /* __ARES_SETUP_H */