• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __CARES_BUILD_H
2 #define __CARES_BUILD_H
3 
4 
5 /* Copyright (C) 2009 - 2013 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_TYPEOF_ARES_SOCKLEN_T
87 #  error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
88    Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
89 #endif
90 
91 /* ================================================================ */
92 /*    EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY    */
93 /* ================================================================ */
94 
95 #if defined(__DJGPP__) || defined(__GO32__)
96 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
97 
98 #elif defined(__SALFORDC__)
99 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
100 
101 #elif defined(__BORLANDC__)
102 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
103 
104 #elif defined(__TURBOC__)
105 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
106 
107 #elif defined(__WATCOMC__)
108 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
109 
110 #elif defined(__POCC__)
111 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
112 
113 #elif defined(__LCC__)
114 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
115 
116 #elif defined(__SYMBIAN32__)
117 #  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
118 
119 #elif defined(__MWERKS__)
120 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
121 
122 #elif defined(_WIN32_WCE)
123 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
124 
125 #elif defined(__MINGW32__)
126 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
127 
128 #elif defined(__VMS)
129 #  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
130 
131 #elif defined(__OS400__)
132 #  if defined(__ILEC400__)
133 #    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
134 #    define CARES_PULL_SYS_TYPES_H      1
135 #    define CARES_PULL_SYS_SOCKET_H     1
136 #  endif
137 
138 #elif defined(__MVS__)
139 #  if defined(__IBMC__) || defined(__IBMCPP__)
140 #    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
141 #    define CARES_PULL_SYS_TYPES_H      1
142 #    define CARES_PULL_SYS_SOCKET_H     1
143 #  endif
144 
145 #elif defined(__370__)
146 #  if defined(__IBMC__) || defined(__IBMCPP__)
147 #    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
148 #    define CARES_PULL_SYS_TYPES_H      1
149 #    define CARES_PULL_SYS_SOCKET_H     1
150 #  endif
151 
152 #elif defined(TPF)
153 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
154 
155 /* ===================================== */
156 /*    KEEP MSVC THE PENULTIMATE ENTRY    */
157 /* ===================================== */
158 
159 #elif defined(_MSC_VER)
160 #  define CARES_TYPEOF_ARES_SOCKLEN_T int
161 
162 /* ===================================== */
163 /*    KEEP GENERIC GCC THE LAST ENTRY    */
164 /* ===================================== */
165 
166 #elif defined(__GNUC__)
167 #  define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
168 #  define CARES_PULL_SYS_TYPES_H      1
169 #  define CARES_PULL_SYS_SOCKET_H     1
170 
171 #else
172 #  error "Unknown non-configure build target!"
173    Error Compilation_aborted_Unknown_non_configure_build_target
174 #endif
175 
176 /* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file  */
177 /* sys/types.h is required here to properly make type definitions below.  */
178 #ifdef CARES_PULL_SYS_TYPES_H
179 #  include <sys/types.h>
180 #endif
181 
182 /* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */
183 /* sys/socket.h is required here to properly make type definitions below.  */
184 #ifdef CARES_PULL_SYS_SOCKET_H
185 #  include <sys/socket.h>
186 #endif
187 
188 /* Data type definition of ares_socklen_t. */
189 
190 #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
191   typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
192 #endif
193 
194 /* Data type definition of ares_ssize_t. */
195 /* gRPC Manuel edit here!
196  * Possibly include <_mingw.h> header to define __int64 type under mingw */
197 #ifdef _WIN32
198 #  ifdef _WIN64
199 #    ifdef __MINGW32__
200 #      include <_mingw.h>
201 #    endif
202 #    define CARES_TYPEOF_ARES_SSIZE_T __int64
203 #  else
204 #    define CARES_TYPEOF_ARES_SSIZE_T long
205 #  endif
206 #else
207 #  define CARES_TYPEOF_ARES_SSIZE_T ssize_t
208 #endif
209 
210 typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
211 
212 /* IMPORTANT: gRPC MANUAL EDIT HERE!
213  * Undefine UNICODE, as c-ares does not use the ANSI version of functions
214  * explicitly. */
215 #ifdef UNICODE
216 #  undef UNICODE
217 #endif
218 
219 #ifdef _UNICODE
220 #  undef _UNICODE
221 #endif
222 
223 #endif /* __CARES_BUILD_H */
224