1 #ifdef TIME_WITH_SYS_TIME
2 /* Time with sys/time test */
19 #ifdef HAVE_FCNTL_O_NONBLOCK
21 /* headers for FCNTL_O_NONBLOCK test */
22 #include <sys/types.h>
26 #if defined(sun) || defined(__sun__) || \
27 defined(__SUNPRO_C) || defined(__SUNPRO_CC)
28 # if defined(__SVR4) || defined(__srv4__)
29 # define PLATFORM_SOLARIS
31 # define PLATFORM_SUNOS4
34 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
35 # define PLATFORM_AIX_V3
38 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
39 #error "O_NONBLOCK does not work on this platform"
45 /* O_NONBLOCK source test */
47 if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
53 #ifdef HAVE_GETHOSTBYADDR_R_5
54 #include <sys/types.h>
64 struct hostent_data hdata;
66 #ifndef gethostbyaddr_r
67 (void)gethostbyaddr_r;
69 rc = gethostbyaddr_r(address, length, type, &h, &hdata);
74 #ifdef HAVE_GETHOSTBYADDR_R_5_REENTRANT
76 #include <sys/types.h>
86 struct hostent_data hdata;
88 #ifndef gethostbyaddr_r
89 (void)gethostbyaddr_r;
91 rc = gethostbyaddr_r(address, length, type, &h, &hdata);
96 #ifdef HAVE_GETHOSTBYADDR_R_7
97 #include <sys/types.h>
111 #ifndef gethostbyaddr_r
112 (void)gethostbyaddr_r;
114 hp = gethostbyaddr_r(address, length, type, &h,
115 buffer, 8192, &h_errnop);
120 #ifdef HAVE_GETHOSTBYADDR_R_7_REENTRANT
122 #include <sys/types.h>
136 #ifndef gethostbyaddr_r
137 (void)gethostbyaddr_r;
139 hp = gethostbyaddr_r(address, length, type, &h,
140 buffer, 8192, &h_errnop);
145 #ifdef HAVE_GETHOSTBYADDR_R_8
146 #include <sys/types.h>
161 #ifndef gethostbyaddr_r
162 (void)gethostbyaddr_r;
164 rc = gethostbyaddr_r(address, length, type, &h,
165 buffer, 8192, &hp, &h_errnop);
170 #ifdef HAVE_GETHOSTBYADDR_R_8_REENTRANT
172 #include <sys/types.h>
187 #ifndef gethostbyaddr_r
188 (void)gethostbyaddr_r;
190 rc = gethostbyaddr_r(address, length, type, &h,
191 buffer, 8192, &hp, &h_errnop);
196 #ifdef HAVE_GETHOSTBYNAME_R_3
198 #include <sys/types.h>
201 #define NULL (void *)0
207 struct hostent_data data;
208 #ifndef gethostbyname_r
209 (void)gethostbyname_r;
211 gethostbyname_r(NULL, NULL, NULL);
216 #ifdef HAVE_GETHOSTBYNAME_R_3_REENTRANT
219 #include <sys/types.h>
222 #define NULL (void *)0
228 struct hostent_data data;
229 #ifndef gethostbyname_r
230 (void)gethostbyname_r;
232 gethostbyname_r(NULL, NULL, NULL);
237 #ifdef HAVE_GETHOSTBYNAME_R_5
238 #include <sys/types.h>
239 #include <netinet/in.h>
242 #define NULL (void *)0
247 #ifndef gethostbyname_r
248 (void)gethostbyname_r;
250 gethostbyname_r(NULL, NULL, NULL, 0, NULL);
255 #ifdef HAVE_GETHOSTBYNAME_R_5_REENTRANT
257 #include <sys/types.h>
260 #define NULL (void *)0
266 #ifndef gethostbyname_r
267 (void)gethostbyname_r;
269 gethostbyname_r(NULL, NULL, NULL, 0, NULL);
274 #ifdef HAVE_GETHOSTBYNAME_R_6
275 #include <sys/types.h>
278 #define NULL (void *)0
284 #ifndef gethostbyname_r
285 (void)gethostbyname_r;
287 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
292 #ifdef HAVE_GETHOSTBYNAME_R_6_REENTRANT
294 #include <sys/types.h>
297 #define NULL (void *)0
303 #ifndef gethostbyname_r
304 (void)gethostbyname_r;
306 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);
311 #ifdef HAVE_SOCKLEN_T
313 #include <ws2tcpip.h>
315 #include <sys/types.h>
316 #include <sys/socket.h>
323 if (sizeof (socklen_t))
329 #ifdef HAVE_IN_ADDR_T
330 #include <sys/types.h>
331 #include <sys/socket.h>
332 #include <arpa/inet.h>
339 if (sizeof (in_addr_t))
347 #ifdef HAVE_SYS_TYPES_H
348 #include <sys/types.h>
350 #ifdef HAVE_STDBOOL_H
356 if (sizeof (bool *) )
368 int main() { return 0; }
370 #ifdef RETSIGTYPE_TEST
371 #include <sys/types.h>
377 extern "C" void (*signal (int, void (*)(int)))(int);
379 void (*signal ()) ();
388 #ifdef HAVE_INET_NTOA_R_DECL
389 #include <arpa/inet.h>
391 typedef void (*func_type)();
397 func = (func_type)inet_ntoa_r;
402 #ifdef HAVE_INET_NTOA_R_DECL_REENTRANT
404 #include <arpa/inet.h>
406 typedef void (*func_type)();
412 func = (func_type)&inet_ntoa_r;
417 #ifdef HAVE_GETADDRINFO
419 #include <sys/types.h>
420 #include <sys/socket.h>
423 struct addrinfo hints, *ai;
426 memset(&hints, 0, sizeof(hints));
427 hints.ai_family = AF_UNSPEC;
428 hints.ai_socktype = SOCK_STREAM;
432 error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
439 #ifdef HAVE_FILE_OFFSET_BITS
440 #ifdef _FILE_OFFSET_BITS
441 #undef _FILE_OFFSET_BITS
443 #define _FILE_OFFSET_BITS 64
444 #include <sys/types.h>
445 /* Check that off_t can represent 2**63 - 1 correctly.
446 We can't simply define LARGE_OFF_T to be 9223372036854775807,
447 since some C++ compilers masquerading as C compilers
448 incorrectly reject 9223372036854775807. */
449 #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
450 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
451 && LARGE_OFF_T % 2147483647 == 1)
453 int main () { ; return 0; }
455 #ifdef HAVE_IOCTLSOCKET
457 #ifdef HAVE_WINDOWS_H
458 # ifndef WIN32_LEAN_AND_MEAN
459 # define WIN32_LEAN_AND_MEAN
461 # include <windows.h>
462 # ifdef HAVE_WINSOCK2_H
463 # include <winsock2.h>
465 # ifdef HAVE_WINSOCK_H
466 # include <winsock.h>
475 /* ioctlsocket source code */
477 unsigned long flags = ioctlsocket(socket, FIONBIO, &flags);
484 #ifdef HAVE_IOCTLSOCKET_CAMEL
486 #ifdef HAVE_WINDOWS_H
487 # ifndef WIN32_LEAN_AND_MEAN
488 # define WIN32_LEAN_AND_MEAN
490 # include <windows.h>
491 # ifdef HAVE_WINSOCK2_H
492 # include <winsock2.h>
494 # ifdef HAVE_WINSOCK_H
495 # include <winsock.h>
504 /* IoctlSocket source code */
505 if(0 != IoctlSocket(0, 0, 0))
511 #ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO
513 #ifdef HAVE_WINDOWS_H
514 # ifndef WIN32_LEAN_AND_MEAN
515 # define WIN32_LEAN_AND_MEAN
517 # include <windows.h>
518 # ifdef HAVE_WINSOCK2_H
519 # include <winsock2.h>
521 # ifdef HAVE_WINSOCK_H
522 # include <winsock.h>
531 /* IoctlSocket source code */
533 if(0 != ioctlsocket(0, FIONBIO, &flags))
539 #ifdef HAVE_IOCTLSOCKET_FIONBIO
541 #ifdef HAVE_WINDOWS_H
542 # ifndef WIN32_LEAN_AND_MEAN
543 # define WIN32_LEAN_AND_MEAN
545 # include <windows.h>
546 # ifdef HAVE_WINSOCK2_H
547 # include <winsock2.h>
549 # ifdef HAVE_WINSOCK_H
550 # include <winsock.h>
560 if(0 != ioctlsocket(0, FIONBIO, &flags))
567 #ifdef HAVE_IOCTL_FIONBIO
568 /* headers for FIONBIO test */
570 #ifdef HAVE_SYS_TYPES_H
571 # include <sys/types.h>
576 #ifdef HAVE_SYS_SOCKET_H
577 # include <sys/socket.h>
579 #ifdef HAVE_SYS_IOCTL_H
580 # include <sys/ioctl.h>
582 #ifdef HAVE_STROPTS_H
583 # include <stropts.h>
591 if(0 != ioctl(0, FIONBIO, &flags))
598 #ifdef HAVE_IOCTL_SIOCGIFADDR
599 /* headers for FIONBIO test */
601 #ifdef HAVE_SYS_TYPES_H
602 # include <sys/types.h>
607 #ifdef HAVE_SYS_SOCKET_H
608 # include <sys/socket.h>
610 #ifdef HAVE_SYS_IOCTL_H
611 # include <sys/ioctl.h>
613 #ifdef HAVE_STROPTS_H
614 # include <stropts.h>
622 if(0 != ioctl(0, SIOCGIFADDR, &ifr))
629 #ifdef HAVE_SETSOCKOPT_SO_NONBLOCK
631 #ifdef HAVE_WINDOWS_H
632 # ifndef WIN32_LEAN_AND_MEAN
633 # define WIN32_LEAN_AND_MEAN
635 # include <windows.h>
636 # ifdef HAVE_WINSOCK2_H
637 # include <winsock2.h>
639 # ifdef HAVE_WINSOCK_H
640 # include <winsock.h>
645 #ifdef HAVE_SYS_TYPES_H
646 # include <sys/types.h>
648 #ifdef HAVE_SYS_SOCKET_H
649 # include <sys/socket.h>
656 if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0))
662 #ifdef HAVE_GLIBC_STRERROR_R
667 char buffer[1024]; /* big enough to play with */
669 strerror_r(EACCES, buffer, sizeof(buffer));
670 /* this should've returned a string */
671 if(!string || !string[0])
676 #ifdef HAVE_POSIX_STRERROR_R
681 char buffer[1024]; /* big enough to play with */
683 strerror_r(EACCES, buffer, sizeof(buffer));
684 /* This should've returned zero, and written an error string in the
686 if(!buffer[0] || error)