Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Utilities / cmcurl / lib / setup-win32.h
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) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, 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
27 /*
28  * Include header files for windows builds before redefining anything.
29  * Use this preprocessor block only to include or exclude windows.h,
30  * winsock2.h or ws2tcpip.h. Any other windows thing belongs
31  * to any other further and independent block.  Under Cygwin things work
32  * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
33  * never be included when __CYGWIN__ is defined.  configure script takes
34  * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK2_H,
35  * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
36  */
37
38 #ifdef HAVE_WINDOWS_H
39 #  if defined(UNICODE) && !defined(_UNICODE)
40 #    error "UNICODE is defined but _UNICODE is not defined"
41 #  endif
42 #  if defined(_UNICODE) && !defined(UNICODE)
43 #    error "_UNICODE is defined but UNICODE is not defined"
44 #  endif
45 /*
46  * Don't include unneeded stuff in Windows headers to avoid compiler
47  * warnings and macro clashes.
48  * Make sure to define this macro before including any Windows headers.
49  */
50 #  ifndef WIN32_LEAN_AND_MEAN
51 #    define WIN32_LEAN_AND_MEAN
52 #  endif
53 #  ifndef NOGDI
54 #    define NOGDI
55 #  endif
56 #  include <winerror.h>
57 #  include <windows.h>
58 #  ifdef HAVE_WINSOCK2_H
59 #    include <winsock2.h>
60 #    ifdef HAVE_WS2TCPIP_H
61 #      include <ws2tcpip.h>
62 #    endif
63 #  endif
64 #  include <tchar.h>
65 #  ifdef UNICODE
66      typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
67 #  endif
68 #endif
69
70 /*
71  * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
72  * undefine USE_WINSOCK.
73  */
74
75 #undef USE_WINSOCK
76
77 #ifdef HAVE_WINSOCK2_H
78 #  define USE_WINSOCK 2
79 #endif
80
81 /*
82  * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
83  * those symbols to compare against, and even those that do may be missing
84  * newer symbols.
85  */
86
87 #ifndef _WIN32_WINNT_NT4
88 #define _WIN32_WINNT_NT4            0x0400   /* Windows NT 4.0 */
89 #endif
90 #ifndef _WIN32_WINNT_WIN2K
91 #define _WIN32_WINNT_WIN2K          0x0500   /* Windows 2000 */
92 #endif
93 #ifndef _WIN32_WINNT_WINXP
94 #define _WIN32_WINNT_WINXP          0x0501   /* Windows XP */
95 #endif
96 #ifndef _WIN32_WINNT_WS03
97 #define _WIN32_WINNT_WS03           0x0502   /* Windows Server 2003 */
98 #endif
99 #ifndef _WIN32_WINNT_WIN6
100 #define _WIN32_WINNT_WIN6           0x0600   /* Windows Vista */
101 #endif
102 #ifndef _WIN32_WINNT_VISTA
103 #define _WIN32_WINNT_VISTA          0x0600   /* Windows Vista */
104 #endif
105 #ifndef _WIN32_WINNT_WS08
106 #define _WIN32_WINNT_WS08           0x0600   /* Windows Server 2008 */
107 #endif
108 #ifndef _WIN32_WINNT_LONGHORN
109 #define _WIN32_WINNT_LONGHORN       0x0600   /* Windows Vista */
110 #endif
111 #ifndef _WIN32_WINNT_WIN7
112 #define _WIN32_WINNT_WIN7           0x0601   /* Windows 7 */
113 #endif
114 #ifndef _WIN32_WINNT_WIN8
115 #define _WIN32_WINNT_WIN8           0x0602   /* Windows 8 */
116 #endif
117 #ifndef _WIN32_WINNT_WINBLUE
118 #define _WIN32_WINNT_WINBLUE        0x0603   /* Windows 8.1 */
119 #endif
120 #ifndef _WIN32_WINNT_WINTHRESHOLD
121 #define _WIN32_WINNT_WINTHRESHOLD   0x0A00   /* Windows 10 */
122 #endif
123 #ifndef _WIN32_WINNT_WIN10
124 #define _WIN32_WINNT_WIN10          0x0A00   /* Windows 10 */
125 #endif
126
127 #endif /* HEADER_CURL_SETUP_WIN32_H */