setup-win32.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #ifndef HEADER_CURL_SETUP_WIN32_H
  2. #define HEADER_CURL_SETUP_WIN32_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * SPDX-License-Identifier: curl
  24. *
  25. ***************************************************************************/
  26. #undef USE_WINSOCK
  27. /* ---------------------------------------------------------------- */
  28. /* Watt-32 TCP/IP SPECIFIC */
  29. /* ---------------------------------------------------------------- */
  30. #ifdef USE_WATT32
  31. # include <tcp.h>
  32. # include <sys/socket.h>
  33. # undef byte
  34. # undef word
  35. # define HAVE_SYS_IOCTL_H
  36. # define HAVE_NETINET_IN_H
  37. # define HAVE_NETDB_H
  38. # define HAVE_ARPA_INET_H
  39. # define SOCKET int
  40. /* ---------------------------------------------------------------- */
  41. /* BSD-style lwIP TCP/IP stack SPECIFIC */
  42. /* ---------------------------------------------------------------- */
  43. #elif defined(USE_LWIPSOCK)
  44. /* Define to use BSD-style lwIP TCP/IP stack. */
  45. /* #define USE_LWIPSOCK 1 */
  46. # undef HAVE_GETHOSTNAME
  47. # undef LWIP_POSIX_SOCKETS_IO_NAMES
  48. # undef RECV_TYPE_ARG1
  49. # undef RECV_TYPE_ARG3
  50. # undef SEND_TYPE_ARG1
  51. # undef SEND_TYPE_ARG3
  52. # define HAVE_GETHOSTBYNAME_R
  53. # define HAVE_GETHOSTBYNAME_R_6
  54. # define LWIP_POSIX_SOCKETS_IO_NAMES 0
  55. # define RECV_TYPE_ARG1 int
  56. # define RECV_TYPE_ARG3 size_t
  57. # define SEND_TYPE_ARG1 int
  58. # define SEND_TYPE_ARG3 size_t
  59. #elif defined(_WIN32)
  60. # define USE_WINSOCK 2
  61. #endif
  62. /*
  63. * Include header files for Windows builds before redefining anything.
  64. * Use this preprocessor block only to include or exclude windows.h,
  65. * winsock2.h or ws2tcpip.h. Any other Windows thing belongs
  66. * to any other further and independent block. Under Cygwin things work
  67. * just as under Linux (e.g. <sys/socket.h>) and the Winsock headers should
  68. * never be included when __CYGWIN__ is defined.
  69. */
  70. #ifdef _WIN32
  71. # if defined(UNICODE) && !defined(_UNICODE)
  72. # error "UNICODE is defined but _UNICODE is not defined"
  73. # endif
  74. # if defined(_UNICODE) && !defined(UNICODE)
  75. # error "_UNICODE is defined but UNICODE is not defined"
  76. # endif
  77. # include <winsock2.h>
  78. # include <ws2tcpip.h>
  79. # include <windows.h>
  80. # include <winerror.h>
  81. # include <tchar.h>
  82. #endif
  83. /*
  84. * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
  85. * those symbols to compare against, and even those that do may be missing
  86. * newer symbols.
  87. */
  88. #ifndef _WIN32_WINNT_WINXP
  89. #define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
  90. #endif
  91. #ifndef _WIN32_WINNT_WS03
  92. #define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
  93. #endif
  94. #ifndef _WIN32_WINNT_VISTA
  95. #define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
  96. #endif
  97. #ifndef _WIN32_WINNT_WS08
  98. #define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
  99. #endif
  100. #ifndef _WIN32_WINNT_WIN7
  101. #define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
  102. #endif
  103. #ifndef _WIN32_WINNT_WIN8
  104. #define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
  105. #endif
  106. #ifndef _WIN32_WINNT_WINBLUE
  107. #define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
  108. #endif
  109. #ifndef _WIN32_WINNT_WIN10
  110. #define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
  111. #endif
  112. #endif /* HEADER_CURL_SETUP_WIN32_H */