6 /* AIX's compiler requires this to be the first thing in the compiled
7 * files. Yay for braindead compilers. */
8 #if defined(__GNUC__) && !defined(HAVE_ALLOCA_H)
9 # define alloca __builtin_alloca
11 # if defined(HAVE_ALLOCA_H)
24 /* These are ANSI C89 headers, so everybody should have them. If
25 * they're missing, we probably don't care much about the platform.
26 * If we do, we can add an autoconf test and try to patch around;
27 * this is the right file for that, after all :)
41 #ifdef TIME_WITH_SYS_TIME
42 # include <sys/time.h>
45 # ifdef HAVE_SYS_TIME_H
46 # include <sys/time.h>
52 #ifdef HAVE_SYS_TYPES_H
53 #include <sys/types.h>
56 #ifdef HAVE_SYS_SOCKET_H
57 #include <sys/socket.h>
64 #ifdef HAVE_WINSOCK2_H
65 /* Windows XP+ only -- older versions lack getaddrinfo() etc. */
66 # define _WIN32_WINNT 0x0501
67 # include <winsock2.h>
70 #ifdef HAVE_WS2TCPIP_H
71 # include <ws2tcpip.h>
79 #define VA_COPY(DEST, SRC) va_copy(DEST, SRC)
81 #define VA_COPY(DEST, SRC) __va_copy(DEST, SRC)
83 #define VA_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof(DEST))
86 #ifndef HAVE_GETTIMEOFDAY
88 extern int gettimeofday(struct timeval * tv, struct timezone * tz);
91 #ifndef HAVE_GETLOCALTIME_R
92 extern struct tm *localtime_r(const time_t *timep, struct tm *result);
96 /* this should use size_t, but some systems don't define it */
97 extern void * memcpy(void * dest, void const * src, unsigned long n);
101 /* this should use size_t, but some systems don't define it */
102 extern void * memset(void * dest, int c, unsigned long n);
106 extern char * strdup(char const * str);
109 #ifndef HAVE_STRERROR
110 extern char const * strerror(int errornum);
113 #ifndef HAVE_STRUCT_ADDRINFO
121 struct sockaddr *ai_addr;
123 struct addrinfo *ai_next;
127 #define AI_CANONNAME 2
128 #define AI_NUMERICHOST 4
130 #endif /* !defined(HAVE_STRUCT_ADDRINFO) */
132 #ifndef HAVE_GETADDRINFO
134 int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
135 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
136 void freeaddrinfo(struct addrinfo *res);
140 #ifndef HAVE_GAI_STRERROR
141 const char *gai_strerror(int errcode);
145 # ifdef WSAEINPROGRESS
146 # define EINPROGRESS WSAEINPROGRESS
147 # define EHOSTUNREACH WSAEHOSTUNREACH
148 # define ECONNREFUSED WSAECONNREFUSED
149 # define ECONNRESET WSAECONNRESET
150 # define ETIMEDOUT WSAETIMEDOUT
154 #endif /* COMPAT_H */