ares_build.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. #ifndef __CARES_BUILD_H
  2. #define __CARES_BUILD_H
  3. /* Copyright (C) 2009 - 2013 by Daniel Stenberg et al
  4. *
  5. * Permission to use, copy, modify, and distribute this software and its
  6. * documentation for any purpose and without fee is hereby granted, provided
  7. * that the above copyright notice appear in all copies and that both that
  8. * copyright notice and this permission notice appear in supporting
  9. * documentation, and that the name of M.I.T. not be used in advertising or
  10. * publicity pertaining to distribution of the software without specific,
  11. * written prior permission. M.I.T. makes no representations about the
  12. * suitability of this software for any purpose. It is provided "as is"
  13. * without express or implied warranty.
  14. */
  15. /* ================================================================ */
  16. /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
  17. /* ================================================================ */
  18. /*
  19. * NOTE 1:
  20. * -------
  21. *
  22. * See file ares_build.h.in, run configure, and forget that this file
  23. * exists it is only used for non-configure systems.
  24. * But you can keep reading if you want ;-)
  25. *
  26. */
  27. /* ================================================================ */
  28. /* NOTES FOR NON-CONFIGURE SYSTEMS */
  29. /* ================================================================ */
  30. /*
  31. * NOTE 1:
  32. * -------
  33. *
  34. * Nothing in this file is intended to be modified or adjusted by the
  35. * c-ares library user nor by the c-ares library builder.
  36. *
  37. * If you think that something actually needs to be changed, adjusted
  38. * or fixed in this file, then, report it on the c-ares development
  39. * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
  40. *
  41. * Try to keep one section per platform, compiler and architecture,
  42. * otherwise, if an existing section is reused for a different one and
  43. * later on the original is adjusted, probably the piggybacking one can
  44. * be adversely changed.
  45. *
  46. * In order to differentiate between platforms/compilers/architectures
  47. * use only compiler built in predefined preprocessor symbols.
  48. *
  49. * This header file shall only export symbols which are 'cares' or 'CARES'
  50. * prefixed, otherwise public name space would be polluted.
  51. *
  52. * NOTE 2:
  53. * -------
  54. *
  55. * Right now you might be staring at file ares_build.h.dist or ares_build.h,
  56. * this is due to the following reason: file ares_build.h.dist is renamed
  57. * to ares_build.h when the c-ares source code distribution archive file is
  58. * created.
  59. *
  60. * File ares_build.h.dist is not included in the distribution archive.
  61. * File ares_build.h is not present in the git tree.
  62. *
  63. * The distributed ares_build.h file is only intended to be used on systems
  64. * which can not run the also distributed configure script.
  65. *
  66. * On systems capable of running the configure script, the configure process
  67. * will overwrite the distributed ares_build.h file with one that is suitable
  68. * and specific to the library being configured and built, which is generated
  69. * from the ares_build.h.in template file.
  70. *
  71. * If you check out from git on a non-configure platform, you must run the
  72. * appropriate buildconf* script to set up ares_build.h and other local files.
  73. *
  74. */
  75. /* ================================================================ */
  76. /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
  77. /* ================================================================ */
  78. #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
  79. # error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
  80. Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
  81. #endif
  82. /* ================================================================ */
  83. /* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
  84. /* ================================================================ */
  85. #if defined(__DJGPP__) || defined(__GO32__)
  86. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  87. #elif defined(__SALFORDC__)
  88. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  89. #elif defined(__BORLANDC__)
  90. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  91. #elif defined(__TURBOC__)
  92. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  93. #elif defined(__WATCOMC__)
  94. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  95. #elif defined(__POCC__)
  96. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  97. #elif defined(__LCC__)
  98. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  99. #elif defined(__SYMBIAN32__)
  100. # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
  101. #elif defined(__MWERKS__)
  102. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  103. #elif defined(_WIN32_WCE)
  104. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  105. #elif defined(__MINGW32__)
  106. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  107. #elif defined(__VMS)
  108. # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
  109. #elif defined(__OS400__)
  110. # if defined(__ILEC400__)
  111. # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
  112. # define CARES_PULL_SYS_TYPES_H 1
  113. # define CARES_PULL_SYS_SOCKET_H 1
  114. # endif
  115. #elif defined(__MVS__)
  116. # if defined(__IBMC__) || defined(__IBMCPP__)
  117. # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
  118. # define CARES_PULL_SYS_TYPES_H 1
  119. # define CARES_PULL_SYS_SOCKET_H 1
  120. # endif
  121. #elif defined(__370__)
  122. # if defined(__IBMC__) || defined(__IBMCPP__)
  123. # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
  124. # define CARES_PULL_SYS_TYPES_H 1
  125. # define CARES_PULL_SYS_SOCKET_H 1
  126. # endif
  127. #elif defined(TPF)
  128. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  129. /* ===================================== */
  130. /* KEEP MSVC THE PENULTIMATE ENTRY */
  131. /* ===================================== */
  132. #elif defined(_MSC_VER)
  133. # define CARES_TYPEOF_ARES_SOCKLEN_T int
  134. /* ===================================== */
  135. /* KEEP GENERIC GCC THE LAST ENTRY */
  136. /* ===================================== */
  137. #elif defined(__GNUC__)
  138. # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
  139. # define CARES_PULL_SYS_TYPES_H 1
  140. # define CARES_PULL_SYS_SOCKET_H 1
  141. #else
  142. # error "Unknown non-configure build target!"
  143. Error Compilation_aborted_Unknown_non_configure_build_target
  144. #endif
  145. /* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file */
  146. /* sys/types.h is required here to properly make type definitions below. */
  147. #ifdef CARES_PULL_SYS_TYPES_H
  148. # include <sys/types.h>
  149. #endif
  150. /* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
  151. /* sys/socket.h is required here to properly make type definitions below. */
  152. #ifdef CARES_PULL_SYS_SOCKET_H
  153. #ifdef _WIN32
  154. # include <ws2tcpip.h>
  155. #else
  156. # include <sys/socket.h>
  157. #endif
  158. #endif
  159. /* Data type definition of ares_socklen_t. */
  160. #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
  161. typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
  162. #endif
  163. /* Data type definition of ares_ssize_t. */
  164. #ifdef _WIN32
  165. # ifdef _WIN64
  166. # define CARES_TYPEOF_ARES_SSIZE_T __int64
  167. # else
  168. # define CARES_TYPEOF_ARES_SSIZE_T long
  169. # endif
  170. #else
  171. # define CARES_TYPEOF_ARES_SSIZE_T ssize_t
  172. #endif
  173. typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
  174. #endif /* __CARES_BUILD_H */