xref: /third_party/cares/include/ares_build.h (revision 324c9471)
1324c9471Sopenharmony_ci#ifndef __CARES_BUILD_H
2324c9471Sopenharmony_ci#define __CARES_BUILD_H
3324c9471Sopenharmony_ci
4324c9471Sopenharmony_ci
5324c9471Sopenharmony_ci/* Copyright (C) 2009 - 2021 by Daniel Stenberg et al
6324c9471Sopenharmony_ci *
7324c9471Sopenharmony_ci * Permission to use, copy, modify, and distribute this software and its
8324c9471Sopenharmony_ci * documentation for any purpose and without fee is hereby granted, provided
9324c9471Sopenharmony_ci * that the above copyright notice appear in all copies and that both that
10324c9471Sopenharmony_ci * copyright notice and this permission notice appear in supporting
11324c9471Sopenharmony_ci * documentation, and that the name of M.I.T. not be used in advertising or
12324c9471Sopenharmony_ci * publicity pertaining to distribution of the software without specific,
13324c9471Sopenharmony_ci * written prior permission.  M.I.T. makes no representations about the
14324c9471Sopenharmony_ci * suitability of this software for any purpose.  It is provided "as is"
15324c9471Sopenharmony_ci * without express or implied warranty.
16324c9471Sopenharmony_ci */
17324c9471Sopenharmony_ci
18324c9471Sopenharmony_ci/* ================================================================ */
19324c9471Sopenharmony_ci/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */
20324c9471Sopenharmony_ci/* ================================================================ */
21324c9471Sopenharmony_ci
22324c9471Sopenharmony_ci/*
23324c9471Sopenharmony_ci * NOTE 1:
24324c9471Sopenharmony_ci * -------
25324c9471Sopenharmony_ci *
26324c9471Sopenharmony_ci * See file ares_build.h.in, run configure, and forget that this file
27324c9471Sopenharmony_ci * exists it is only used for non-configure systems.
28324c9471Sopenharmony_ci * But you can keep reading if you want ;-)
29324c9471Sopenharmony_ci *
30324c9471Sopenharmony_ci */
31324c9471Sopenharmony_ci
32324c9471Sopenharmony_ci/* ================================================================ */
33324c9471Sopenharmony_ci/*                 NOTES FOR NON-CONFIGURE SYSTEMS                  */
34324c9471Sopenharmony_ci/* ================================================================ */
35324c9471Sopenharmony_ci
36324c9471Sopenharmony_ci/*
37324c9471Sopenharmony_ci * NOTE 1:
38324c9471Sopenharmony_ci * -------
39324c9471Sopenharmony_ci *
40324c9471Sopenharmony_ci * Nothing in this file is intended to be modified or adjusted by the
41324c9471Sopenharmony_ci * c-ares library user nor by the c-ares library builder.
42324c9471Sopenharmony_ci *
43324c9471Sopenharmony_ci * If you think that something actually needs to be changed, adjusted
44324c9471Sopenharmony_ci * or fixed in this file, then, report it on the c-ares development
45324c9471Sopenharmony_ci * mailing list: http://lists.haxx.se/listinfo/c-ares/
46324c9471Sopenharmony_ci *
47324c9471Sopenharmony_ci * Try to keep one section per platform, compiler and architecture,
48324c9471Sopenharmony_ci * otherwise, if an existing section is reused for a different one and
49324c9471Sopenharmony_ci * later on the original is adjusted, probably the piggybacking one can
50324c9471Sopenharmony_ci * be adversely changed.
51324c9471Sopenharmony_ci *
52324c9471Sopenharmony_ci * In order to differentiate between platforms/compilers/architectures
53324c9471Sopenharmony_ci * use only compiler built in predefined preprocessor symbols.
54324c9471Sopenharmony_ci *
55324c9471Sopenharmony_ci * This header file shall only export symbols which are 'cares' or 'CARES'
56324c9471Sopenharmony_ci * prefixed, otherwise public name space would be polluted.
57324c9471Sopenharmony_ci *
58324c9471Sopenharmony_ci * NOTE 2:
59324c9471Sopenharmony_ci * -------
60324c9471Sopenharmony_ci *
61324c9471Sopenharmony_ci * Right now you might be staring at file ares_build.h.dist or ares_build.h,
62324c9471Sopenharmony_ci * this is due to the following reason: file ares_build.h.dist is renamed
63324c9471Sopenharmony_ci * to ares_build.h when the c-ares source code distribution archive file is
64324c9471Sopenharmony_ci * created.
65324c9471Sopenharmony_ci *
66324c9471Sopenharmony_ci * File ares_build.h.dist is not included in the distribution archive.
67324c9471Sopenharmony_ci * File ares_build.h is not present in the git tree.
68324c9471Sopenharmony_ci *
69324c9471Sopenharmony_ci * The distributed ares_build.h file is only intended to be used on systems
70324c9471Sopenharmony_ci * which can not run the also distributed configure script.
71324c9471Sopenharmony_ci *
72324c9471Sopenharmony_ci * On systems capable of running the configure script, the configure process
73324c9471Sopenharmony_ci * will overwrite the distributed ares_build.h file with one that is suitable
74324c9471Sopenharmony_ci * and specific to the library being configured and built, which is generated
75324c9471Sopenharmony_ci * from the ares_build.h.in template file.
76324c9471Sopenharmony_ci *
77324c9471Sopenharmony_ci * If you check out from git on a non-configure platform, you must run the
78324c9471Sopenharmony_ci * appropriate buildconf* script to set up ares_build.h and other local files.
79324c9471Sopenharmony_ci *
80324c9471Sopenharmony_ci */
81324c9471Sopenharmony_ci
82324c9471Sopenharmony_ci/* ================================================================ */
83324c9471Sopenharmony_ci/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */
84324c9471Sopenharmony_ci/* ================================================================ */
85324c9471Sopenharmony_ci
86324c9471Sopenharmony_ci#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
87324c9471Sopenharmony_ci#  error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
88324c9471Sopenharmony_ci   Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
89324c9471Sopenharmony_ci#endif
90324c9471Sopenharmony_ci
91324c9471Sopenharmony_ci/* ================================================================ */
92324c9471Sopenharmony_ci/*    EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY    */
93324c9471Sopenharmony_ci/* ================================================================ */
94324c9471Sopenharmony_ci
95324c9471Sopenharmony_ci#if defined(__DJGPP__) || defined(__GO32__)
96324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
97324c9471Sopenharmony_ci
98324c9471Sopenharmony_ci#elif defined(__SALFORDC__)
99324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
100324c9471Sopenharmony_ci
101324c9471Sopenharmony_ci#elif defined(__BORLANDC__)
102324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
103324c9471Sopenharmony_ci
104324c9471Sopenharmony_ci#elif defined(__TURBOC__)
105324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
106324c9471Sopenharmony_ci
107324c9471Sopenharmony_ci#elif defined(__WATCOMC__)
108324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
109324c9471Sopenharmony_ci
110324c9471Sopenharmony_ci#elif defined(__POCC__)
111324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
112324c9471Sopenharmony_ci
113324c9471Sopenharmony_ci#elif defined(__LCC__)
114324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
115324c9471Sopenharmony_ci
116324c9471Sopenharmony_ci#elif defined(__SYMBIAN32__)
117324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
118324c9471Sopenharmony_ci
119324c9471Sopenharmony_ci#elif defined(__MWERKS__)
120324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
121324c9471Sopenharmony_ci
122324c9471Sopenharmony_ci#elif defined(_WIN32_WCE)
123324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
124324c9471Sopenharmony_ci
125324c9471Sopenharmony_ci#elif defined(__MINGW32__)
126324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
127324c9471Sopenharmony_ci
128324c9471Sopenharmony_ci#elif defined(__VMS)
129324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
130324c9471Sopenharmony_ci
131324c9471Sopenharmony_ci#elif defined(__OS400__)
132324c9471Sopenharmony_ci#  if defined(__ILEC400__)
133324c9471Sopenharmony_ci#    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
134324c9471Sopenharmony_ci#    define CARES_PULL_SYS_TYPES_H      1
135324c9471Sopenharmony_ci#    define CARES_PULL_SYS_SOCKET_H     1
136324c9471Sopenharmony_ci#  endif
137324c9471Sopenharmony_ci
138324c9471Sopenharmony_ci#elif defined(__MVS__)
139324c9471Sopenharmony_ci#  if defined(__IBMC__) || defined(__IBMCPP__)
140324c9471Sopenharmony_ci#    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
141324c9471Sopenharmony_ci#    define CARES_PULL_SYS_TYPES_H      1
142324c9471Sopenharmony_ci#    define CARES_PULL_SYS_SOCKET_H     1
143324c9471Sopenharmony_ci#  endif
144324c9471Sopenharmony_ci
145324c9471Sopenharmony_ci#elif defined(__370__)
146324c9471Sopenharmony_ci#  if defined(__IBMC__) || defined(__IBMCPP__)
147324c9471Sopenharmony_ci#    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
148324c9471Sopenharmony_ci#    define CARES_PULL_SYS_TYPES_H      1
149324c9471Sopenharmony_ci#    define CARES_PULL_SYS_SOCKET_H     1
150324c9471Sopenharmony_ci#  endif
151324c9471Sopenharmony_ci
152324c9471Sopenharmony_ci#elif defined(TPF)
153324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
154324c9471Sopenharmony_ci
155324c9471Sopenharmony_ci/* ===================================== */
156324c9471Sopenharmony_ci/*    KEEP MSVC THE PENULTIMATE ENTRY    */
157324c9471Sopenharmony_ci/* ===================================== */
158324c9471Sopenharmony_ci
159324c9471Sopenharmony_ci#elif defined(_MSC_VER)
160324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
161324c9471Sopenharmony_ci
162324c9471Sopenharmony_ci/* ===================================== */
163324c9471Sopenharmony_ci/*    KEEP GENERIC GCC THE LAST ENTRY    */
164324c9471Sopenharmony_ci/* ===================================== */
165324c9471Sopenharmony_ci
166324c9471Sopenharmony_ci#elif defined(__GNUC__)
167324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
168324c9471Sopenharmony_ci#  define CARES_PULL_SYS_TYPES_H      1
169324c9471Sopenharmony_ci#  define CARES_PULL_SYS_SOCKET_H     1
170324c9471Sopenharmony_ci
171324c9471Sopenharmony_ci#else
172324c9471Sopenharmony_ci#  error "Unknown non-configure build target!"
173324c9471Sopenharmony_ci   Error Compilation_aborted_Unknown_non_configure_build_target
174324c9471Sopenharmony_ci#endif
175324c9471Sopenharmony_ci
176324c9471Sopenharmony_ci/* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file  */
177324c9471Sopenharmony_ci/* sys/types.h is required here to properly make type definitions below.  */
178324c9471Sopenharmony_ci#ifdef CARES_PULL_SYS_TYPES_H
179324c9471Sopenharmony_ci#  include <sys/types.h>
180324c9471Sopenharmony_ci#endif
181324c9471Sopenharmony_ci
182324c9471Sopenharmony_ci/* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */
183324c9471Sopenharmony_ci/* sys/socket.h is required here to properly make type definitions below.  */
184324c9471Sopenharmony_ci#ifdef CARES_PULL_SYS_SOCKET_H
185324c9471Sopenharmony_ci#  include <sys/socket.h>
186324c9471Sopenharmony_ci#endif
187324c9471Sopenharmony_ci
188324c9471Sopenharmony_ci/* Data type definition of ares_socklen_t. */
189324c9471Sopenharmony_ci
190324c9471Sopenharmony_ci#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
191324c9471Sopenharmony_ci  typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
192324c9471Sopenharmony_ci#endif
193324c9471Sopenharmony_ci
194324c9471Sopenharmony_ci/* Data type definition of ares_ssize_t. */
195324c9471Sopenharmony_ci#ifdef _WIN32
196324c9471Sopenharmony_ci#  ifdef _WIN64
197324c9471Sopenharmony_ci#    define CARES_TYPEOF_ARES_SSIZE_T __int64
198324c9471Sopenharmony_ci#  else
199324c9471Sopenharmony_ci#    define CARES_TYPEOF_ARES_SSIZE_T long
200324c9471Sopenharmony_ci#  endif
201324c9471Sopenharmony_ci#else
202324c9471Sopenharmony_ci#  define CARES_TYPEOF_ARES_SSIZE_T ssize_t
203324c9471Sopenharmony_ci#endif
204324c9471Sopenharmony_ci
205324c9471Sopenharmony_citypedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
206324c9471Sopenharmony_ci
207324c9471Sopenharmony_ci#endif /* __CARES_BUILD_H */
208