blob: 3675592ff9f7907530b39110f0e99644b5f90854 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.haxx.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ***************************************************************************/
22#include "test.h"
23
24#include "testutil.h"
25#include "warnless.h"
26#include "memdebug.h"
27
28#define XSTR(x) #x
29#define STRING(y) XSTR(y)
30
31int test(char *URL)
32{
33 char detect[512];
34 char syst[512];
35
36 const char *types_h = "No";
37 const char *socket_h = "No";
38 const char *ws2tcpip_h = "No";
39 const char *stypes_h = "No";
40 const char *ssocket_h = "No";
41 const char *sws2tcpip_h = "No";
42
43 (void)(URL);
44
45#ifdef CURL_PULL_SYS_TYPES_H
46 types_h = "Yes";
47#endif
48#ifdef CURL_PULL_SYS_SOCKET_H
49 socket_h = "Yes";
50#endif
51#ifdef CURL_PULL_WS2TCPIP_H
52 ws2tcpip_h = "Yes";
53#endif
54 snprintf(detect, sizeof(detect),
55#ifdef CHECK_CURL_OFF_T
56 "CURL_TYPEOF_CURL_OFF_T: %s\n"
57#endif
58 "CURL_FORMAT_CURL_OFF_T: %s\n"
59 "CURL_FORMAT_CURL_OFF_TU: %s\n"
60 "CURL_SUFFIX_CURL_OFF_T: %s\n"
61 "CURL_SUFFIX_CURL_OFF_TU: %s\n"
62 "CURL_SIZEOF_CURL_OFF_T: %d\n"
63 "CURL_SIZEOF_LONG: %d\n"
64 "CURL_TYPEOF_CURL_SOCKLEN_T: %s\n"
65 "CURL_PULL_SYS_TYPES_H: %s\n"
66 "CURL_PULL_SYS_SOCKET_H: %s\n"
67 "CURL_PULL_WS2TCPIP_H: %s\n"
68
69#ifdef CHECK_CURL_OFF_T
70 , STRING(CURL_TYPEOF_CURL_OFF_T)
71#endif
72 , CURL_FORMAT_CURL_OFF_T
73 , CURL_FORMAT_CURL_OFF_TU
74 , STRING(CURL_SUFFIX_CURL_OFF_T)
75 , STRING(CURL_SUFFIX_CURL_OFF_TU)
76 , CURL_SIZEOF_CURL_OFF_T
77 , CURL_SIZEOF_LONG
78 , STRING(CURL_TYPEOF_CURL_SOCKLEN_T)
79 , types_h
80 , socket_h
81 , ws2tcpip_h);
82
83#ifdef CURLSYS_PULL_SYS_TYPES_H
84 stypes_h = "Yes";
85#endif
86#ifdef CURLSYS_PULL_SYS_SOCKET_H
87 ssocket_h = "Yes";
88#endif
89#ifdef CURLSYS_PULL_WS2TCPIP_H
90 sws2tcpip_h = "Yes";
91#endif
92 snprintf(syst, sizeof(syst),
93#ifdef CHECK_CURL_OFF_T
94 "CURL_TYPEOF_CURL_OFF_T: %s\n"
95#endif
96 "CURL_FORMAT_CURL_OFF_T: %s\n"
97 "CURL_FORMAT_CURL_OFF_TU: %s\n"
98 "CURL_SUFFIX_CURL_OFF_T: %s\n"
99 "CURL_SUFFIX_CURL_OFF_TU: %s\n"
100 "CURL_SIZEOF_CURL_OFF_T: %d\n"
101 "CURL_SIZEOF_LONG: %d\n"
102 "CURL_TYPEOF_CURL_SOCKLEN_T: %s\n"
103 "CURL_PULL_SYS_TYPES_H: %s\n"
104 "CURL_PULL_SYS_SOCKET_H: %s\n"
105 "CURL_PULL_WS2TCPIP_H: %s\n"
106
107#ifdef CHECK_CURL_OFF_T
108 , STRING(CURLSYS_TYPEOF_CURL_OFF_T)
109#endif
110 , CURLSYS_FORMAT_CURL_OFF_T
111 , CURLSYS_FORMAT_CURL_OFF_TU
112 , STRING(CURLSYS_SUFFIX_CURL_OFF_T)
113 , STRING(CURLSYS_SUFFIX_CURL_OFF_TU)
114 , CURLSYS_SIZEOF_CURL_OFF_T
115 , CURLSYS_SIZEOF_LONG
116 , STRING(CURLSYS_TYPEOF_CURL_SOCKLEN_T)
117 , stypes_h
118 , ssocket_h
119 , sws2tcpip_h);
120
121 if(strcmp(detect, syst)) {
122 printf("===> Type detection failed <====\n");
123 printf("[Detected]\n%s", detect);
124 printf("[System]\n%s", syst);
125 return 1; /* FAIL! */
126 }
127
128 return 0;
129}