1 #ifndef __CARES_BUILD_H
2 #define __CARES_BUILD_H
3 
4 
5 /* Copyright (C) 2009 - 2010 by Daniel Stenberg et al
6  *
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.
16  */
17 
18 /* ================================================================ */
19 /*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */
20 /* ================================================================ */
21 
22 /*
23  * NOTE 1:
24  * -------
25  *
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 ;-)
29  *
30  */
31 
32 /* ================================================================ */
33 /*                 NOTES FOR NON-CONFIGURE SYSTEMS                  */
34 /* ================================================================ */
35 
36 /*
37  * NOTE 1:
38  * -------
39  *
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.
42  *
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/
46  *
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.
51  *
52  * In order to differentiate between platforms/compilers/architectures
53  * use only compiler built in predefined preprocessor symbols.
54  *
55  * This header file shall only export symbols which are 'cares' or 'CARES'
56  * prefixed, otherwise public name space would be polluted.
57  *
58  * NOTE 2:
59  * -------
60  *
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
64  * created.
65  *
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.
68  *
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.
71  *
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.
76  *
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.
79  *
80  */
81 
82 /* ================================================================ */
83 /*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */
84 /* ================================================================ */
85 
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
89 #endif
90 
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
94 #endif
95 
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
99 #endif
100 
101 /* ================================================================ */
102 /*    EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY    */
103 /* ================================================================ */
104 
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
109 
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
114 
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
119 
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
124 
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
129 
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
134 
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
139 
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
144 
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
149 
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
154 
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
159 
160 #elif defined(__VMS)
161 #  define CARES_SIZEOF_LONG           4
162 #  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
163 #  define CARES_SIZEOF_ARES_SOCKLEN_T 4
164 
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
172 #  endif
173 
174 #elif defined(__MVS__)
175 #  if defined(__IBMC__) || defined(__IBMCPP__)
176 #    if defined(_ILP32)
177 #      define CARES_SIZEOF_LONG           4
178 #    elif defined(_LP64)
179 #      define CARES_SIZEOF_LONG           8
180 #    endif
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
185 #  endif
186 
187 #elif defined(__370__)
188 #  if defined(__IBMC__) || defined(__IBMCPP__)
189 #    if defined(_ILP32)
190 #      define CARES_SIZEOF_LONG           4
191 #    elif defined(_LP64)
192 #      define CARES_SIZEOF_LONG           8
193 #    endif
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
198 #  endif
199 
200 #elif defined(TPF)
201 #  define CARES_SIZEOF_LONG           8
202 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
203 #  define CARES_SIZEOF_ARES_SOCKLEN_T 4
204 
205 /* ===================================== */
206 /*    KEEP MSVC THE PENULTIMATE ENTRY    */
207 /* ===================================== */
208 
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
213 
214 /* ===================================== */
215 /*    KEEP GENERIC GCC THE LAST ENTRY    */
216 /* ===================================== */
217 
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
223 #  else
224 #    define CARES_SIZEOF_LONG           sizeof(long)
225 #  endif
226 #  define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
227 #  define CARES_SIZEOF_ARES_SOCKLEN_T 4
228 #  define CARES_PULL_SYS_TYPES_H      1
229 #  define CARES_PULL_SYS_SOCKET_H     1
230 
231 #else
232 #  error "Unknown non-configure build target!"
233    Error Compilation_aborted_Unknown_non_configure_build_target
234 #endif
235 
236 /* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file  */
237 /* sys/types.h is required here to properly make type definitions below.  */
238 #ifdef CARES_PULL_SYS_TYPES_H
239 #  include <sys/types.h>
240 #endif
241 
242 /* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */
243 /* sys/socket.h is required here to properly make type definitions below.  */
244 #ifdef CARES_PULL_SYS_SOCKET_H
245 #  include <sys/socket.h>
246 #endif
247 
248 /* Data type definition of ares_socklen_t. */
249 
250 #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
251   typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
252 #endif
253 
254 #endif /* __CARES_BUILD_H */
255