1 #ifndef __CARES_BUILD_H
2 #define __CARES_BUILD_H
5 /* Copyright (C) 2009 - 2010 by Daniel Stenberg et al
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation for any purpose and without fee is hereby granted, provided
9 * that the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of M.I.T. not be used in advertising or
12 * publicity pertaining to distribution of the software without specific,
13 * written prior permission. M.I.T. makes no representations about the
14 * suitability of this software for any purpose. It is provided "as is"
15 * without express or implied warranty.
18 /* ================================================================ */
19 /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
20 /* ================================================================ */
26 * See file ares_build.h.in, run configure, and forget that this file
27 * exists it is only used for non-configure systems.
28 * But you can keep reading if you want ;-)
32 /* ================================================================ */
33 /* NOTES FOR NON-CONFIGURE SYSTEMS */
34 /* ================================================================ */
40 * Nothing in this file is intended to be modified or adjusted by the
41 * c-ares library user nor by the c-ares library builder.
43 * If you think that something actually needs to be changed, adjusted
44 * or fixed in this file, then, report it on the c-ares development
45 * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
47 * Try to keep one section per platform, compiler and architecture,
48 * otherwise, if an existing section is reused for a different one and
49 * later on the original is adjusted, probably the piggybacking one can
50 * be adversely changed.
52 * In order to differentiate between platforms/compilers/architectures
53 * use only compiler built in predefined preprocessor symbols.
55 * This header file shall only export symbols which are 'cares' or 'CARES'
56 * prefixed, otherwise public name space would be polluted.
61 * Right now you might be staring at file ares_build.h.dist or ares_build.h,
62 * this is due to the following reason: file ares_build.h.dist is renamed
63 * to ares_build.h when the c-ares source code distribution archive file is
66 * File ares_build.h.dist is not included in the distribution archive.
67 * File ares_build.h is not present in the git tree.
69 * The distributed ares_build.h file is only intended to be used on systems
70 * which can not run the also distributed configure script.
72 * On systems capable of running the configure script, the configure process
73 * will overwrite the distributed ares_build.h file with one that is suitable
74 * and specific to the library being configured and built, which is generated
75 * from the ares_build.h.in template file.
77 * If you check out from git on a non-configure platform, you must run the
78 * appropriate buildconf* script to set up ares_build.h and other local files.
82 /* ================================================================ */
83 /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
84 /* ================================================================ */
86 #ifdef CARES_SIZEOF_LONG
87 # error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
88 Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
91 #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
92 # error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
93 Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
96 #ifdef CARES_SIZEOF_ARES_SOCKLEN_T
97 # error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
98 Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
101 /* ================================================================ */
102 /* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
103 /* ================================================================ */
105 #if defined(__DJGPP__) || defined(__GO32__)
106 # define CARES_SIZEOF_LONG 4
107 # define CARES_TYPEOF_ARES_SOCKLEN_T int
108 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
110 #elif defined(__SALFORDC__)
111 # define CARES_SIZEOF_LONG 4
112 # define CARES_TYPEOF_ARES_SOCKLEN_T int
113 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
115 #elif defined(__BORLANDC__)
116 # define CARES_SIZEOF_LONG 4
117 # define CARES_TYPEOF_ARES_SOCKLEN_T int
118 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
120 #elif defined(__TURBOC__)
121 # define CARES_SIZEOF_LONG 4
122 # define CARES_TYPEOF_ARES_SOCKLEN_T int
123 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
125 #elif defined(__WATCOMC__)
126 # define CARES_SIZEOF_LONG 4
127 # define CARES_TYPEOF_ARES_SOCKLEN_T int
128 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
130 #elif defined(__POCC__)
131 # define CARES_SIZEOF_LONG 4
132 # define CARES_TYPEOF_ARES_SOCKLEN_T int
133 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
135 #elif defined(__LCC__)
136 # define CARES_SIZEOF_LONG 4
137 # define CARES_TYPEOF_ARES_SOCKLEN_T int
138 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
140 #elif defined(__SYMBIAN32__)
141 # define CARES_SIZEOF_LONG 4
142 # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
143 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
145 #elif defined(__MWERKS__)
146 # define CARES_SIZEOF_LONG 4
147 # define CARES_TYPEOF_ARES_SOCKLEN_T int
148 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
150 #elif defined(_WIN32_WCE)
151 # define CARES_SIZEOF_LONG 4
152 # define CARES_TYPEOF_ARES_SOCKLEN_T int
153 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
155 #elif defined(__MINGW32__)
156 # define CARES_SIZEOF_LONG 4
157 # define CARES_TYPEOF_ARES_SOCKLEN_T int
158 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
161 # define CARES_SIZEOF_LONG 4
162 # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
163 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
165 #elif defined(__OS400__)
166 # if defined(__ILEC400__)
167 # define CARES_SIZEOF_LONG 4
168 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
169 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
170 # define CARES_PULL_SYS_TYPES_H 1
171 # define CARES_PULL_SYS_SOCKET_H 1
174 #elif defined(__MVS__)
175 # if defined(__IBMC__) || defined(__IBMCPP__)
177 # define CARES_SIZEOF_LONG 4
178 # elif defined(_LP64)
179 # define CARES_SIZEOF_LONG 8
181 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
182 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
183 # define CARES_PULL_SYS_TYPES_H 1
184 # define CARES_PULL_SYS_SOCKET_H 1
187 #elif defined(__370__)
188 # if defined(__IBMC__) || defined(__IBMCPP__)
190 # define CARES_SIZEOF_LONG 4
191 # elif defined(_LP64)
192 # define CARES_SIZEOF_LONG 8
194 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
195 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
196 # define CARES_PULL_SYS_TYPES_H 1
197 # define CARES_PULL_SYS_SOCKET_H 1
201 # define CARES_SIZEOF_LONG 8
202 # define CARES_TYPEOF_ARES_SOCKLEN_T int
203 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
205 /* ===================================== */
206 /* KEEP MSVC THE PENULTIMATE ENTRY */
207 /* ===================================== */
209 #elif defined(_MSC_VER)
210 # define CARES_SIZEOF_LONG 4
211 # define CARES_TYPEOF_ARES_SOCKLEN_T int
212 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
214 /* ===================================== */
215 /* KEEP GENERIC GCC THE LAST ENTRY */
216 /* ===================================== */
218 #elif defined(__GNUC__)
219 # if defined(__i386__) || defined(__ppc__)
220 # define CARES_SIZEOF_LONG 4
221 # elif defined(__x86_64__) || defined(__ppc64__)
222 # define CARES_SIZEOF_LONG 8
224 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
225 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
226 # define CARES_PULL_SYS_TYPES_H 1
227 # define CARES_PULL_SYS_SOCKET_H 1
230 # error "Unknown non-configure build target!"
231 Error Compilation_aborted_Unknown_non_configure_build_target
234 /* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file */
235 /* sys/types.h is required here to properly make type definitions below. */
236 #ifdef CARES_PULL_SYS_TYPES_H
237 # include <sys/types.h>
240 /* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
241 /* sys/socket.h is required here to properly make type definitions below. */
242 #ifdef CARES_PULL_SYS_SOCKET_H
243 # include <sys/socket.h>
246 /* Data type definition of ares_socklen_t. */
248 #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
249 typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
252 #endif /* __CARES_BUILD_H */