11cb0ef41Sopenharmony_ci/* MIT License
21cb0ef41Sopenharmony_ci *
31cb0ef41Sopenharmony_ci * Copyright (c) 2009 Daniel Stenberg
41cb0ef41Sopenharmony_ci *
51cb0ef41Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy
61cb0ef41Sopenharmony_ci * of this software and associated documentation files (the "Software"), to deal
71cb0ef41Sopenharmony_ci * in the Software without restriction, including without limitation the rights
81cb0ef41Sopenharmony_ci * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
91cb0ef41Sopenharmony_ci * copies of the Software, and to permit persons to whom the Software is
101cb0ef41Sopenharmony_ci * furnished to do so, subject to the following conditions:
111cb0ef41Sopenharmony_ci *
121cb0ef41Sopenharmony_ci * The above copyright notice and this permission notice (including the next
131cb0ef41Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
141cb0ef41Sopenharmony_ci * Software.
151cb0ef41Sopenharmony_ci *
161cb0ef41Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
171cb0ef41Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
181cb0ef41Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
191cb0ef41Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
201cb0ef41Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
211cb0ef41Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
221cb0ef41Sopenharmony_ci * SOFTWARE.
231cb0ef41Sopenharmony_ci *
241cb0ef41Sopenharmony_ci * SPDX-License-Identifier: MIT
251cb0ef41Sopenharmony_ci */
261cb0ef41Sopenharmony_ci#ifndef __CARES_BUILD_H
271cb0ef41Sopenharmony_ci#define __CARES_BUILD_H
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci/* ================================================================ */
311cb0ef41Sopenharmony_ci/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */
321cb0ef41Sopenharmony_ci/* ================================================================ */
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci/*
351cb0ef41Sopenharmony_ci * NOTE 1:
361cb0ef41Sopenharmony_ci * -------
371cb0ef41Sopenharmony_ci *
381cb0ef41Sopenharmony_ci * See file ares_build.h.in, run configure, and forget that this file
391cb0ef41Sopenharmony_ci * exists it is only used for non-configure systems.
401cb0ef41Sopenharmony_ci * But you can keep reading if you want ;-)
411cb0ef41Sopenharmony_ci *
421cb0ef41Sopenharmony_ci */
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ci/* ================================================================ */
451cb0ef41Sopenharmony_ci/*                 NOTES FOR NON-CONFIGURE SYSTEMS                  */
461cb0ef41Sopenharmony_ci/* ================================================================ */
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci/*
491cb0ef41Sopenharmony_ci * NOTE 1:
501cb0ef41Sopenharmony_ci * -------
511cb0ef41Sopenharmony_ci *
521cb0ef41Sopenharmony_ci * Nothing in this file is intended to be modified or adjusted by the
531cb0ef41Sopenharmony_ci * c-ares library user nor by the c-ares library builder.
541cb0ef41Sopenharmony_ci *
551cb0ef41Sopenharmony_ci * If you think that something actually needs to be changed, adjusted
561cb0ef41Sopenharmony_ci * or fixed in this file, then, report it on the c-ares development
571cb0ef41Sopenharmony_ci * mailing list: http://lists.haxx.se/listinfo/c-ares/
581cb0ef41Sopenharmony_ci *
591cb0ef41Sopenharmony_ci * Try to keep one section per platform, compiler and architecture,
601cb0ef41Sopenharmony_ci * otherwise, if an existing section is reused for a different one and
611cb0ef41Sopenharmony_ci * later on the original is adjusted, probably the piggybacking one can
621cb0ef41Sopenharmony_ci * be adversely changed.
631cb0ef41Sopenharmony_ci *
641cb0ef41Sopenharmony_ci * In order to differentiate between platforms/compilers/architectures
651cb0ef41Sopenharmony_ci * use only compiler built in predefined preprocessor symbols.
661cb0ef41Sopenharmony_ci *
671cb0ef41Sopenharmony_ci * This header file shall only export symbols which are 'cares' or 'CARES'
681cb0ef41Sopenharmony_ci * prefixed, otherwise public name space would be polluted.
691cb0ef41Sopenharmony_ci *
701cb0ef41Sopenharmony_ci * NOTE 2:
711cb0ef41Sopenharmony_ci * -------
721cb0ef41Sopenharmony_ci *
731cb0ef41Sopenharmony_ci * Right now you might be staring at file ares_build.h.dist or ares_build.h,
741cb0ef41Sopenharmony_ci * this is due to the following reason: file ares_build.h.dist is renamed
751cb0ef41Sopenharmony_ci * to ares_build.h when the c-ares source code distribution archive file is
761cb0ef41Sopenharmony_ci * created.
771cb0ef41Sopenharmony_ci *
781cb0ef41Sopenharmony_ci * File ares_build.h.dist is not included in the distribution archive.
791cb0ef41Sopenharmony_ci * File ares_build.h is not present in the git tree.
801cb0ef41Sopenharmony_ci *
811cb0ef41Sopenharmony_ci * The distributed ares_build.h file is only intended to be used on systems
821cb0ef41Sopenharmony_ci * which can not run the also distributed configure script.
831cb0ef41Sopenharmony_ci *
841cb0ef41Sopenharmony_ci * On systems capable of running the configure script, the configure process
851cb0ef41Sopenharmony_ci * will overwrite the distributed ares_build.h file with one that is suitable
861cb0ef41Sopenharmony_ci * and specific to the library being configured and built, which is generated
871cb0ef41Sopenharmony_ci * from the ares_build.h.in template file.
881cb0ef41Sopenharmony_ci *
891cb0ef41Sopenharmony_ci * If you check out from git on a non-configure platform, you must run the
901cb0ef41Sopenharmony_ci * appropriate buildconf* script to set up ares_build.h and other local files.
911cb0ef41Sopenharmony_ci *
921cb0ef41Sopenharmony_ci */
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ci/* ================================================================ */
951cb0ef41Sopenharmony_ci/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */
961cb0ef41Sopenharmony_ci/* ================================================================ */
971cb0ef41Sopenharmony_ci
981cb0ef41Sopenharmony_ci#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
991cb0ef41Sopenharmony_ci#  error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
1001cb0ef41Sopenharmony_ci   Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
1011cb0ef41Sopenharmony_ci#endif
1021cb0ef41Sopenharmony_ci
1031cb0ef41Sopenharmony_ci/* ================================================================ */
1041cb0ef41Sopenharmony_ci/*    EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY    */
1051cb0ef41Sopenharmony_ci/* ================================================================ */
1061cb0ef41Sopenharmony_ci
1071cb0ef41Sopenharmony_ci#if defined(__DJGPP__) || defined(__GO32__)
1081cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1091cb0ef41Sopenharmony_ci
1101cb0ef41Sopenharmony_ci#elif defined(__SALFORDC__)
1111cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1121cb0ef41Sopenharmony_ci
1131cb0ef41Sopenharmony_ci#elif defined(__BORLANDC__)
1141cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_ci#elif defined(__TURBOC__)
1171cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1181cb0ef41Sopenharmony_ci
1191cb0ef41Sopenharmony_ci#elif defined(__WATCOMC__)
1201cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1211cb0ef41Sopenharmony_ci
1221cb0ef41Sopenharmony_ci#elif defined(__POCC__)
1231cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1241cb0ef41Sopenharmony_ci
1251cb0ef41Sopenharmony_ci#elif defined(__LCC__)
1261cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1271cb0ef41Sopenharmony_ci
1281cb0ef41Sopenharmony_ci#elif defined(__SYMBIAN32__)
1291cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
1301cb0ef41Sopenharmony_ci
1311cb0ef41Sopenharmony_ci#elif defined(__MWERKS__)
1321cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1331cb0ef41Sopenharmony_ci
1341cb0ef41Sopenharmony_ci#elif defined(_WIN32_WCE)
1351cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci#elif defined(__MINGW32__)
1381cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1391cb0ef41Sopenharmony_ci
1401cb0ef41Sopenharmony_ci#elif defined(__VMS)
1411cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
1421cb0ef41Sopenharmony_ci
1431cb0ef41Sopenharmony_ci#elif defined(__OS400__)
1441cb0ef41Sopenharmony_ci#  if defined(__ILEC400__)
1451cb0ef41Sopenharmony_ci#    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
1461cb0ef41Sopenharmony_ci#    define CARES_PULL_SYS_TYPES_H      1
1471cb0ef41Sopenharmony_ci#    define CARES_PULL_SYS_SOCKET_H     1
1481cb0ef41Sopenharmony_ci#  endif
1491cb0ef41Sopenharmony_ci
1501cb0ef41Sopenharmony_ci#elif defined(__MVS__)
1511cb0ef41Sopenharmony_ci#  if defined(__IBMC__) || defined(__IBMCPP__)
1521cb0ef41Sopenharmony_ci#    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
1531cb0ef41Sopenharmony_ci#    define CARES_PULL_SYS_TYPES_H      1
1541cb0ef41Sopenharmony_ci#    define CARES_PULL_SYS_SOCKET_H     1
1551cb0ef41Sopenharmony_ci#  endif
1561cb0ef41Sopenharmony_ci
1571cb0ef41Sopenharmony_ci#elif defined(__370__)
1581cb0ef41Sopenharmony_ci#  if defined(__IBMC__) || defined(__IBMCPP__)
1591cb0ef41Sopenharmony_ci#    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
1601cb0ef41Sopenharmony_ci#    define CARES_PULL_SYS_TYPES_H      1
1611cb0ef41Sopenharmony_ci#    define CARES_PULL_SYS_SOCKET_H     1
1621cb0ef41Sopenharmony_ci#  endif
1631cb0ef41Sopenharmony_ci
1641cb0ef41Sopenharmony_ci#elif defined(TPF)
1651cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1661cb0ef41Sopenharmony_ci
1671cb0ef41Sopenharmony_ci/* ===================================== */
1681cb0ef41Sopenharmony_ci/*    KEEP MSVC THE PENULTIMATE ENTRY    */
1691cb0ef41Sopenharmony_ci/* ===================================== */
1701cb0ef41Sopenharmony_ci
1711cb0ef41Sopenharmony_ci#elif defined(_MSC_VER)
1721cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T int
1731cb0ef41Sopenharmony_ci
1741cb0ef41Sopenharmony_ci/* ===================================== */
1751cb0ef41Sopenharmony_ci/*    KEEP GENERIC GCC THE LAST ENTRY    */
1761cb0ef41Sopenharmony_ci/* ===================================== */
1771cb0ef41Sopenharmony_ci
1781cb0ef41Sopenharmony_ci#elif defined(__GNUC__)
1791cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
1801cb0ef41Sopenharmony_ci#  define CARES_PULL_SYS_TYPES_H      1
1811cb0ef41Sopenharmony_ci#  define CARES_PULL_SYS_SOCKET_H     1
1821cb0ef41Sopenharmony_ci
1831cb0ef41Sopenharmony_ci#else
1841cb0ef41Sopenharmony_ci#  error "Unknown non-configure build target!"
1851cb0ef41Sopenharmony_ci   Error Compilation_aborted_Unknown_non_configure_build_target
1861cb0ef41Sopenharmony_ci#endif
1871cb0ef41Sopenharmony_ci
1881cb0ef41Sopenharmony_ci/* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file  */
1891cb0ef41Sopenharmony_ci/* sys/types.h is required here to properly make type definitions below.  */
1901cb0ef41Sopenharmony_ci#ifdef CARES_PULL_SYS_TYPES_H
1911cb0ef41Sopenharmony_ci#  include <sys/types.h>
1921cb0ef41Sopenharmony_ci#endif
1931cb0ef41Sopenharmony_ci
1941cb0ef41Sopenharmony_ci/* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */
1951cb0ef41Sopenharmony_ci/* sys/socket.h is required here to properly make type definitions below.  */
1961cb0ef41Sopenharmony_ci#ifdef CARES_PULL_SYS_SOCKET_H
1971cb0ef41Sopenharmony_ci#  include <sys/socket.h>
1981cb0ef41Sopenharmony_ci#endif
1991cb0ef41Sopenharmony_ci
2001cb0ef41Sopenharmony_ci/* Data type definition of ares_socklen_t. */
2011cb0ef41Sopenharmony_ci
2021cb0ef41Sopenharmony_ci#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
2031cb0ef41Sopenharmony_ci  typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
2041cb0ef41Sopenharmony_ci#endif
2051cb0ef41Sopenharmony_ci
2061cb0ef41Sopenharmony_ci/* Data type definition of ares_ssize_t. */
2071cb0ef41Sopenharmony_ci#ifdef _WIN32
2081cb0ef41Sopenharmony_ci#  ifdef _WIN64
2091cb0ef41Sopenharmony_ci#    define CARES_TYPEOF_ARES_SSIZE_T __int64
2101cb0ef41Sopenharmony_ci#  else
2111cb0ef41Sopenharmony_ci#    define CARES_TYPEOF_ARES_SSIZE_T long
2121cb0ef41Sopenharmony_ci#  endif
2131cb0ef41Sopenharmony_ci#else
2141cb0ef41Sopenharmony_ci#  define CARES_TYPEOF_ARES_SSIZE_T ssize_t
2151cb0ef41Sopenharmony_ci#endif
2161cb0ef41Sopenharmony_ci
2171cb0ef41Sopenharmony_citypedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
2181cb0ef41Sopenharmony_ci
2191cb0ef41Sopenharmony_ci#endif /* __CARES_BUILD_H */
220