Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / CMake / CurlTests.c
blobd74a4f01664c3c366a55184e4c0e73c13e5505e8
1 #ifdef TIME_WITH_SYS_TIME
2 /* Time with sys/time test */
4 #include <sys/types.h>
5 #include <sys/time.h>
6 #include <time.h>
8 int
9 main ()
11 if ((struct tm *) 0)
12 return 0;
14 return 0;
17 #endif
19 #ifdef HAVE_O_NONBLOCK
21 #include <sys/types.h>
22 #include <unistd.h>
23 #include <fcntl.h>
25 int
26 main ()
28 /* try to compile O_NONBLOCK */
30 #if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
31 # if defined(__SVR4) || defined(__srv4__)
32 # define PLATFORM_SOLARIS
33 # else
34 # define PLATFORM_SUNOS4
35 # endif
36 #endif
37 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX4)
38 # define PLATFORM_AIX_V3
39 #endif
41 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || (defined(__BEOS__) && !defined(__HAIKU__))
42 #error "O_NONBLOCK does not work on this platform"
43 #endif
44 int socket;
45 int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
46 return 0;
48 #endif
50 #ifdef HAVE_GETHOSTBYADDR_R_5
51 #include <sys/types.h>
52 #include <netdb.h>
53 int
54 main ()
57 char * address;
58 int length;
59 int type;
60 struct hostent h;
61 struct hostent_data hdata;
62 int rc;
63 #ifndef gethostbyaddr_r
64 (void)gethostbyaddr_r;
65 #endif
66 rc = gethostbyaddr_r(address, length, type, &h, &hdata);
68 return 0;
70 #endif
71 #ifdef HAVE_GETHOSTBYADDR_R_5_REENTRANT
72 #define _REENTRANT
73 #include <sys/types.h>
74 #include <netdb.h>
75 int
76 main ()
79 char * address;
80 int length;q
81 int type;
82 struct hostent h;
83 struct hostent_data hdata;
84 int rc;
85 #ifndef gethostbyaddr_r
86 (void)gethostbyaddr_r;
87 #endif
88 rc = gethostbyaddr_r(address, length, type, &h, &hdata);
90 return 0;
92 #endif
93 #ifdef HAVE_GETHOSTBYADDR_R_7
94 #include <sys/types.h>
95 #include <netdb.h>
96 int
97 main ()
100 char * address;
101 int length;
102 int type;
103 struct hostent h;
104 char buffer[8192];
105 int h_errnop;
106 struct hostent * hp;
108 #ifndef gethostbyaddr_r
109 (void)gethostbyaddr_r;
110 #endif
111 hp = gethostbyaddr_r(address, length, type, &h,
112 buffer, 8192, &h_errnop);
114 return 0;
116 #endif
117 #ifdef HAVE_GETHOSTBYADDR_R_7_REENTRANT
118 #define _REENTRANT
119 #include <sys/types.h>
120 #include <netdb.h>
122 main ()
125 char * address;
126 int length;
127 int type;
128 struct hostent h;
129 char buffer[8192];
130 int h_errnop;
131 struct hostent * hp;
133 #ifndef gethostbyaddr_r
134 (void)gethostbyaddr_r;
135 #endif
136 hp = gethostbyaddr_r(address, length, type, &h,
137 buffer, 8192, &h_errnop);
139 return 0;
141 #endif
142 #ifdef HAVE_GETHOSTBYADDR_R_8
143 #include <sys/types.h>
144 #include <netdb.h>
146 main ()
149 char * address;
150 int length;
151 int type;
152 struct hostent h;
153 char buffer[8192];
154 int h_errnop;
155 struct hostent * hp;
156 int rc;
158 #ifndef gethostbyaddr_r
159 (void)gethostbyaddr_r;
160 #endif
161 rc = gethostbyaddr_r(address, length, type, &h,
162 buffer, 8192, &hp, &h_errnop);
164 return 0;
166 #endif
167 #ifdef HAVE_GETHOSTBYADDR_R_8_REENTRANT
168 #define _REENTRANT
169 #include <sys/types.h>
170 #include <netdb.h>
172 main ()
175 char * address;
176 int length;
177 int type;
178 struct hostent h;
179 char buffer[8192];
180 int h_errnop;
181 struct hostent * hp;
182 int rc;
184 #ifndef gethostbyaddr_r
185 (void)gethostbyaddr_r;
186 #endif
187 rc = gethostbyaddr_r(address, length, type, &h,
188 buffer, 8192, &hp, &h_errnop);
190 return 0;
192 #endif
193 #ifdef HAVE_GETHOSTBYNAME_R_3
194 #include <string.h>
195 #include <sys/types.h>
196 #include <netdb.h>
197 #undef NULL
198 #define NULL (void *)0
201 main ()
204 struct hostent_data data;
205 #ifndef gethostbyname_r
206 (void)gethostbyname_r;
207 #endif
208 gethostbyname_r(NULL, NULL, NULL);
210 return 0;
212 #endif
213 #ifdef HAVE_GETHOSTBYNAME_R_3_REENTRANT
214 #define _REENTRANT
215 #include <string.h>
216 #include <sys/types.h>
217 #include <netdb.h>
218 #undef NULL
219 #define NULL (void *)0
222 main ()
225 struct hostent_data data;
226 #ifndef gethostbyname_r
227 (void)gethostbyname_r;
228 #endif
229 gethostbyname_r(NULL, NULL, NULL);
231 return 0;
233 #endif
234 #ifdef HAVE_GETHOSTBYNAME_R_5
235 #include <sys/types.h>
236 #include <netinet/in.h>
237 #include <netdb.h>
238 #undef NULL
239 #define NULL (void *)0
242 main ()
244 #ifndef gethostbyname_r
245 (void)gethostbyname_r;
246 #endif
247 gethostbyname_r(NULL, NULL, NULL, 0, NULL);
249 return 0;
251 #endif
252 #ifdef HAVE_GETHOSTBYNAME_R_5_REENTRANT
253 #define _REENTRANT
254 #include <sys/types.h>
255 #include <netdb.h>
256 #undef NULL
257 #define NULL (void *)0
260 main ()
263 #ifndef gethostbyname_r
264 (void)gethostbyname_r;
265 #endif
266 gethostbyname_r(NULL, NULL, NULL, 0, NULL);
268 return 0;
270 #endif
271 #ifdef HAVE_GETHOSTBYNAME_R_6
272 #include <sys/types.h>
273 #include <netdb.h>
274 #undef NULL
275 #define NULL (void *)0
278 main ()
281 #ifndef gethostbyname_r
282 (void)gethostbyname_r;
283 #endif
284 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
286 return 0;
288 #endif
289 #ifdef HAVE_GETHOSTBYNAME_R_6_REENTRANT
290 #define _REENTRANT
291 #include <sys/types.h>
292 #include <netdb.h>
293 #undef NULL
294 #define NULL (void *)0
297 main ()
300 #ifndef gethostbyname_r
301 (void)gethostbyname_r;
302 #endif
303 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
305 return 0;
307 #endif
308 #ifdef HAVE_SOCKLEN_T
309 #ifdef _WIN32
310 #include <ws2tcpip.h>
311 #else
312 #include <sys/types.h>
313 #include <sys/socket.h>
314 #endif
316 main ()
318 if ((socklen_t *) 0)
319 return 0;
320 if (sizeof (socklen_t))
321 return 0;
323 return 0;
325 #endif
326 #ifdef HAVE_IN_ADDR_T
327 #include <sys/types.h>
328 #include <sys/socket.h>
329 #include <arpa/inet.h>
332 main ()
334 if ((in_addr_t *) 0)
335 return 0;
336 if (sizeof (in_addr_t))
337 return 0;
339 return 0;
341 #endif
342 #ifdef STDC_HEADERS
343 #include <stdlib.h>
344 #include <stdarg.h>
345 #include <string.h>
346 #include <float.h>
347 int main() { return 0; }
348 #endif
349 #ifdef RETSIGTYPE_TEST
350 #include <sys/types.h>
351 #include <signal.h>
352 #ifdef signal
353 # undef signal
354 #endif
355 #ifdef __cplusplus
356 extern "C" void (*signal (int, void (*)(int)))(int);
357 #else
358 void (*signal ()) ();
359 #endif
362 main ()
364 return 0;
366 #endif
367 #ifdef HAVE_INET_NTOA_R_DECL
368 #include <arpa/inet.h>
370 typedef void (*func_type)();
372 int main()
374 #ifndef inet_ntoa_r
375 func_type func;
376 func = (func_type)inet_ntoa_r;
377 #endif
378 return 0;
380 #endif
381 #ifdef HAVE_INET_NTOA_R_DECL_REENTRANT
382 #define _REENTRANT
383 #include <arpa/inet.h>
385 typedef void (*func_type)();
387 int main()
389 #ifndef inet_ntoa_r
390 func_type func;
391 func = (func_type)&inet_ntoa_r;
392 #endif
393 return 0;
395 #endif
396 #ifdef HAVE_GETADDRINFO
397 #include <netdb.h>
398 #include <sys/types.h>
399 #include <sys/socket.h>
401 int main(void) {
402 struct addrinfo hints, *ai;
403 int error;
405 memset(&hints, 0, sizeof(hints));
406 hints.ai_family = AF_UNSPEC;
407 hints.ai_socktype = SOCK_STREAM;
408 #ifndef getaddrinfo
409 (void)getaddrinfo;
410 #endif
411 error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
412 if (error) {
413 return 1;
415 return 0;
417 #endif
418 #ifdef HAVE_FILE_OFFSET_BITS
419 #ifdef _FILE_OFFSET_BITS
420 #undef _FILE_OFFSET_BITS
421 #endif
422 #define _FILE_OFFSET_BITS 64
423 #include <sys/types.h>
424 /* Check that off_t can represent 2**63 - 1 correctly.
425 We can't simply define LARGE_OFF_T to be 9223372036854775807,
426 since some C++ compilers masquerading as C compilers
427 incorrectly reject 9223372036854775807. */
428 #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
429 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
430 && LARGE_OFF_T % 2147483647 == 1)
431 ? 1 : -1];
432 int main () { ; return 0; }
433 #endif
434 #ifdef HAVE_IOCTLSOCKET
435 #include <windows.h>
438 main ()
441 /* ioctlsocket source code */
442 int socket;
443 unsigned long flags = ioctlsocket(socket, FIONBIO, &flags);
446 return 0;
449 #endif
450 #ifdef HAVE_IOCTLSOCKET_CASE
451 #include <windows.h>
454 main ()
457 /* IoctlSocket source code */
458 int socket;
459 int flags = IoctlSocket(socket, FIONBIO, (long)1);
462 return 0;
464 #endif
465 #ifdef HAVE_FIONBIO
466 /* headers for FIONBIO test */
467 #include <unistd.h>
468 #include <stropts.h>
471 main ()
474 /* FIONBIO source test (old-style unix) */
475 int socket;
476 int flags = ioctl(socket, FIONBIO, &flags);
479 return 0;
481 #endif
482 #ifdef HAVE_SO_NONBLOCK
484 /* headers for SO_NONBLOCK test (BeOS) */
485 #include <sys/types.h>
486 #include <unistd.h>
487 #include <fcntl.h>
489 int main()
491 /* SO_NONBLOCK source code */
492 long b = 1;
493 int socket;
494 int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
495 return 0;
497 #endif
498 #ifdef HAVE_GLIBC_STRERROR_R
499 #include <string.h>
500 #include <errno.h>
502 main () {
503 char buffer[1024]; /* big enough to play with */
504 char *string =
505 strerror_r(EACCES, buffer, sizeof(buffer));
506 /* this should've returned a string */
507 if(!string || !string[0])
508 return 99;
509 return 0;
511 #endif
512 #ifdef HAVE_POSIX_STRERROR_R
513 #include <string.h>
514 #include <errno.h>
516 main () {
517 char buffer[1024]; /* big enough to play with */
518 int error =
519 strerror_r(EACCES, buffer, sizeof(buffer));
520 /* This should've returned zero, and written an error string in the
521 buffer.*/
522 if(!buffer[0] || error)
523 return 99;
524 return 0;
526 #endif