1 #ifndef __CARES_BUILD_H
2 #define __CARES_BUILD_H
6 /* Copyright (C) 2009 - 2010 by Daniel Stenberg et al
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.
19 /* ================================================================ */
20 /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
21 /* ================================================================ */
27 * See file ares_build.h.in, run configure, and forget that this file
28 * exists it is only used for non-configure systems.
29 * But you can keep reading if you want ;-)
33 /* ================================================================ */
34 /* NOTES FOR NON-CONFIGURE SYSTEMS */
35 /* ================================================================ */
41 * Nothing in this file is intended to be modified or adjusted by the
42 * c-ares library user nor by the c-ares library builder.
44 * If you think that something actually needs to be changed, adjusted
45 * or fixed in this file, then, report it on the c-ares development
46 * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
48 * Try to keep one section per platform, compiler and architecture,
49 * otherwise, if an existing section is reused for a different one and
50 * later on the original is adjusted, probably the piggybacking one can
51 * be adversely changed.
53 * In order to differentiate between platforms/compilers/architectures
54 * use only compiler built in predefined preprocessor symbols.
56 * This header file shall only export symbols which are 'cares' or 'CARES'
57 * prefixed, otherwise public name space would be polluted.
62 * Right now you might be staring at file ares_build.h.dist or ares_build.h,
63 * this is due to the following reason: file ares_build.h.dist is renamed
64 * to ares_build.h when the c-ares source code distribution archive file is
67 * File ares_build.h.dist is not included in the distribution archive.
68 * File ares_build.h is not present in the git tree.
70 * The distributed ares_build.h file is only intended to be used on systems
71 * which can not run the also distributed configure script.
73 * On systems capable of running the configure script, the configure process
74 * will overwrite the distributed ares_build.h file with one that is suitable
75 * and specific to the library being configured and built, which is generated
76 * from the ares_build.h.in template file.
78 * If you check out from git on a non-configure platform, you must run the
79 * appropriate buildconf* script to set up ares_build.h and other local files.
83 /* ================================================================ */
84 /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
85 /* ================================================================ */
87 #ifdef CARES_SIZEOF_LONG
88 # error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
89 Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
92 #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
93 # error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
94 Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
97 #ifdef CARES_SIZEOF_ARES_SOCKLEN_T
98 # error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
99 Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
102 /* ================================================================ */
103 /* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
104 /* ================================================================ */
106 #if defined(__DJGPP__) || defined(__GO32__)
107 # define CARES_SIZEOF_LONG 4
108 # define CARES_TYPEOF_ARES_SOCKLEN_T int
109 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
111 #elif defined(__SALFORDC__)
112 # define CARES_SIZEOF_LONG 4
113 # define CARES_TYPEOF_ARES_SOCKLEN_T int
114 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
116 #elif defined(__BORLANDC__)
117 # define CARES_SIZEOF_LONG 4
118 # define CARES_TYPEOF_ARES_SOCKLEN_T int
119 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
121 #elif defined(__TURBOC__)
122 # define CARES_SIZEOF_LONG 4
123 # define CARES_TYPEOF_ARES_SOCKLEN_T int
124 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
126 #elif defined(__WATCOMC__)
127 # define CARES_SIZEOF_LONG 4
128 # define CARES_TYPEOF_ARES_SOCKLEN_T int
129 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
131 #elif defined(__POCC__)
132 # define CARES_SIZEOF_LONG 4
133 # define CARES_TYPEOF_ARES_SOCKLEN_T int
134 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
136 #elif defined(__LCC__)
137 # define CARES_SIZEOF_LONG 4
138 # define CARES_TYPEOF_ARES_SOCKLEN_T int
139 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
141 #elif defined(__SYMBIAN32__)
142 # define CARES_SIZEOF_LONG 4
143 # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
144 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
146 #elif defined(__MWERKS__)
147 # define CARES_SIZEOF_LONG 4
148 # define CARES_TYPEOF_ARES_SOCKLEN_T int
149 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
151 #elif defined(_WIN32_WCE)
152 # define CARES_SIZEOF_LONG 4
153 # define CARES_TYPEOF_ARES_SOCKLEN_T int
154 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
156 #elif defined(__MINGW32__)
157 # define CARES_SIZEOF_LONG 4
158 # define CARES_TYPEOF_ARES_SOCKLEN_T int
159 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
162 # define CARES_SIZEOF_LONG 4
163 # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
164 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
166 #elif defined(__OS400__)
167 # if defined(__ILEC400__)
168 # define CARES_SIZEOF_LONG 4
169 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
170 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
171 # define CARES_PULL_SYS_TYPES_H 1
172 # define CARES_PULL_SYS_SOCKET_H 1
175 #elif defined(__MVS__)
176 # if defined(__IBMC__) || defined(__IBMCPP__)
178 # define CARES_SIZEOF_LONG 4
179 # elif defined(_LP64)
180 # define CARES_SIZEOF_LONG 8
182 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
183 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
184 # define CARES_PULL_SYS_TYPES_H 1
185 # define CARES_PULL_SYS_SOCKET_H 1
188 #elif defined(__370__)
189 # if defined(__IBMC__) || defined(__IBMCPP__)
191 # define CARES_SIZEOF_LONG 4
192 # elif defined(_LP64)
193 # define CARES_SIZEOF_LONG 8
195 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
196 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
197 # define CARES_PULL_SYS_TYPES_H 1
198 # define CARES_PULL_SYS_SOCKET_H 1
202 # define CARES_SIZEOF_LONG 8
203 # define CARES_TYPEOF_ARES_SOCKLEN_T int
204 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
206 /* ===================================== */
207 /* KEEP MSVC THE PENULTIMATE ENTRY */
208 /* ===================================== */
210 #elif defined(_MSC_VER)
211 # define CARES_SIZEOF_LONG 4
212 # define CARES_TYPEOF_ARES_SOCKLEN_T int
213 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
215 /* ===================================== */
216 /* KEEP GENERIC GCC THE LAST ENTRY */
217 /* ===================================== */
219 #elif defined(__GNUC__)
220 # if defined(__i386__) || defined(__ppc__)
221 # define CARES_SIZEOF_LONG 4
222 # elif defined(__x86_64__) || defined(__ppc64__)
223 # define CARES_SIZEOF_LONG 8
225 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
226 # define CARES_SIZEOF_ARES_SOCKLEN_T 4
227 # define CARES_PULL_SYS_TYPES_H 1
228 # define CARES_PULL_SYS_SOCKET_H 1
231 # error "Unknown non-configure build target!"
232 Error Compilation_aborted_Unknown_non_configure_build_target
235 /* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file */
236 /* sys/types.h is required here to properly make type definitions below. */
237 #ifdef CARES_PULL_SYS_TYPES_H
238 # include <sys/types.h>
241 /* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
242 /* sys/socket.h is required here to properly make type definitions below. */
243 #ifdef CARES_PULL_SYS_SOCKET_H
244 # include <sys/socket.h>
247 /* Data type definition of ares_socklen_t. */
249 #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
250 typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
253 #endif /* __CARES_BUILD_H */