1 /* MIT License 2 * 3 * Copyright (c) 2009 Daniel Stenberg 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a copy 6 * of this software and associated documentation files (the "Software"), to deal 7 * in the Software without restriction, including without limitation the rights 8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 * copies of the Software, and to permit persons to whom the Software is 10 * furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the next 13 * paragraph) shall be included in all copies or substantial portions of the 14 * Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * SOFTWARE. 23 * 24 * SPDX-License-Identifier: MIT 25 */ 26 #ifndef __CARES_BUILD_H 27 #define __CARES_BUILD_H 28 29 30 /* ================================================================ */ 31 /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ 32 /* ================================================================ */ 33 34 /* 35 * NOTE 1: 36 * ------- 37 * 38 * See file ares_build.h.in, run configure, and forget that this file 39 * exists it is only used for non-configure systems. 40 * But you can keep reading if you want ;-) 41 * 42 */ 43 44 /* ================================================================ */ 45 /* NOTES FOR NON-CONFIGURE SYSTEMS */ 46 /* ================================================================ */ 47 48 /* 49 * NOTE 1: 50 * ------- 51 * 52 * Nothing in this file is intended to be modified or adjusted by the 53 * c-ares library user nor by the c-ares library builder. 54 * 55 * If you think that something actually needs to be changed, adjusted 56 * or fixed in this file, then, report it on the c-ares development 57 * mailing list: http://lists.haxx.se/listinfo/c-ares/ 58 * 59 * Try to keep one section per platform, compiler and architecture, 60 * otherwise, if an existing section is reused for a different one and 61 * later on the original is adjusted, probably the piggybacking one can 62 * be adversely changed. 63 * 64 * In order to differentiate between platforms/compilers/architectures 65 * use only compiler built in predefined preprocessor symbols. 66 * 67 * This header file shall only export symbols which are 'cares' or 'CARES' 68 * prefixed, otherwise public name space would be polluted. 69 * 70 * NOTE 2: 71 * ------- 72 * 73 * Right now you might be staring at file ares_build.h.dist or ares_build.h, 74 * this is due to the following reason: file ares_build.h.dist is renamed 75 * to ares_build.h when the c-ares source code distribution archive file is 76 * created. 77 * 78 * File ares_build.h.dist is not included in the distribution archive. 79 * File ares_build.h is not present in the git tree. 80 * 81 * The distributed ares_build.h file is only intended to be used on systems 82 * which can not run the also distributed configure script. 83 * 84 * On systems capable of running the configure script, the configure process 85 * will overwrite the distributed ares_build.h file with one that is suitable 86 * and specific to the library being configured and built, which is generated 87 * from the ares_build.h.in template file. 88 * 89 * If you check out from git on a non-configure platform, you must run the 90 * appropriate buildconf* script to set up ares_build.h and other local files. 91 * 92 */ 93 94 /* ================================================================ */ 95 /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ 96 /* ================================================================ */ 97 98 #ifdef CARES_TYPEOF_ARES_SOCKLEN_T 99 # error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" 100 Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined 101 #endif 102 103 /* ================================================================ */ 104 /* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */ 105 /* ================================================================ */ 106 107 #if defined(__DJGPP__) || defined(__GO32__) 108 # define CARES_TYPEOF_ARES_SOCKLEN_T int 109 110 #elif defined(__SALFORDC__) 111 # define CARES_TYPEOF_ARES_SOCKLEN_T int 112 113 #elif defined(__BORLANDC__) 114 # define CARES_TYPEOF_ARES_SOCKLEN_T int 115 116 #elif defined(__TURBOC__) 117 # define CARES_TYPEOF_ARES_SOCKLEN_T int 118 119 #elif defined(__WATCOMC__) 120 # define CARES_TYPEOF_ARES_SOCKLEN_T int 121 122 #elif defined(__POCC__) 123 # define CARES_TYPEOF_ARES_SOCKLEN_T int 124 125 #elif defined(__LCC__) 126 # define CARES_TYPEOF_ARES_SOCKLEN_T int 127 128 #elif defined(__SYMBIAN32__) 129 # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int 130 131 #elif defined(__MWERKS__) 132 # define CARES_TYPEOF_ARES_SOCKLEN_T int 133 134 #elif defined(_WIN32_WCE) 135 # define CARES_TYPEOF_ARES_SOCKLEN_T int 136 137 #elif defined(__VMS) 138 # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int 139 140 #elif defined(__OS400__) 141 # if defined(__ILEC400__) 142 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t 143 # define CARES_HAVE_SYS_TYPES_H 1 144 # define CARES_HAVE_SYS_SOCKET_H 1 145 # define CARES_HAVE_SYS_SELECT_H 1 146 # endif 147 148 #elif defined(__MVS__) 149 # if defined(__IBMC__) || defined(__IBMCPP__) 150 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t 151 # define CARES_HAVE_SYS_TYPES_H 1 152 # define CARES_HAVE_SYS_SOCKET_H 1 153 # define CARES_HAVE_SYS_SELECT_H 1 154 # endif 155 156 #elif defined(__370__) 157 # if defined(__IBMC__) || defined(__IBMCPP__) 158 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t 159 # define CARES_HAVE_SYS_TYPES_H 1 160 # define CARES_HAVE_SYS_SOCKET_H 1 161 # define CARES_HAVE_SYS_SELECT_H 1 162 # endif 163 164 #elif defined(TPF) 165 # define CARES_TYPEOF_ARES_SOCKLEN_T int 166 167 #elif defined(_WIN32) 168 # define CARES_TYPEOF_ARES_SOCKLEN_T int 169 # define CARES_HAVE_WINDOWS_H 1 170 # define CARES_HAVE_SYS_TYPES_H 1 171 172 # if defined(WATT32) 173 # define CARES_HAVE_SYS_SOCKET_H 1 174 # define CARES_HAVE_SYS_SELECT_H 1 175 # else 176 # define CARES_HAVE_WS2TCPIP_H 1 177 # define CARES_HAVE_WINSOCK2_H 1 178 # endif 179 180 #elif defined(__GNUC__) 181 # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t 182 # define CARES_HAVE_SYS_TYPES_H 1 183 # define CARES_HAVE_SYS_SOCKET_H 1 184 # define CARES_HAVE_SYS_SELECT_H 1 185 186 #else 187 # error "Unknown non-configure build target!" 188 Error Compilation_aborted_Unknown_non_configure_build_target 189 #endif 190 191 /* Data type definition of ares_ssize_t. */ 192 #ifdef _WIN32 193 # ifdef _WIN64 194 # define CARES_TYPEOF_ARES_SSIZE_T __int64 195 # else 196 # define CARES_TYPEOF_ARES_SSIZE_T long 197 # endif 198 #else 199 # define CARES_TYPEOF_ARES_SSIZE_T ssize_t 200 #endif 201 202 #endif /* __CARES_BUILD_H */ 203