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>
68 #ifdef HAVE_WINSOCK2_H
69 /* Windows XP+ only -- older versions lack getaddrinfo() etc. */
70 # define _WIN32_WINNT 0x0501
71 # include <winsock2.h>
74 #ifdef HAVE_WS2TCPIP_H
75 # include <ws2tcpip.h>
82 /* Cygwin (for example) doesn't define LINE_MAX, although mingw does. */
83 #if !defined(LINE_MAX)
84 # define LINE_MAX 2048
88 #define VA_COPY(DEST, SRC) va_copy(DEST, SRC)
90 #define VA_COPY(DEST, SRC) __va_copy(DEST, SRC)
92 #define VA_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof(DEST))
95 #ifndef HAVE_GETTIMEOFDAY
97 extern int gettimeofday(struct timeval * tv, struct timezone * tz);
100 #ifndef HAVE_LOCALTIME_R
101 extern struct tm *localtime_r(const time_t *timep, struct tm *result);
105 /* this should use size_t, but some systems don't define it */
106 extern void * memcpy(void * dest, void const * src, unsigned long n);
110 /* this should use size_t, but some systems don't define it */
111 extern void * memset(void * dest, int c, unsigned long n);
115 extern char * strdup(char const * str);
118 #ifndef HAVE_STRERROR
119 extern char const * strerror(int errornum);
122 #ifndef HAVE_STRUCT_ADDRINFO
130 struct sockaddr *ai_addr;
132 struct addrinfo *ai_next;
136 #define AI_CANONNAME 2
137 #define AI_NUMERICHOST 4
139 #endif /* !defined(HAVE_STRUCT_ADDRINFO) */
141 #ifndef HAVE_GETADDRINFO
142 int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
143 void freeaddrinfo(struct addrinfo *res);
146 #ifndef HAVE_GAI_STRERROR
147 const char *gai_strerror(int errcode);
151 # define EAI_FAMILY -1
152 # define EAI_NONAME -2
153 # define EAI_OVERFLOW -3
155 # define EAI_AGAIN -5
158 #ifndef HAVE_GETNAMEINFO
160 #define NI_NUMERICHOST 1
162 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
167 # ifdef WSAEINPROGRESS
168 # define EINPROGRESS WSAEINPROGRESS
169 # define EHOSTUNREACH WSAEHOSTUNREACH
170 # define ECONNREFUSED WSAECONNREFUSED
171 # define ECONNRESET WSAECONNRESET
172 # define ETIMEDOUT WSAETIMEDOUT
177 # define SIGCHLD SIGCLD
180 #endif /* COMPAT_H */