]>
Commit | Line | Data |
---|---|---|
d76ed9a9 AS |
1 | #ifndef COMPAT_H |
2 | #define COMPAT_H | |
3 | ||
4 | #include "config.h" | |
5 | ||
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 | |
10 | #else | |
11 | # if defined(HAVE_ALLOCA_H) | |
12 | # include <alloca.h> | |
13 | # else | |
14 | # ifdef _AIX | |
15 | # pragma alloca | |
16 | # else | |
17 | # ifndef alloca | |
18 | char *alloca(); | |
19 | # endif | |
20 | # endif | |
21 | # endif | |
22 | #endif | |
23 | ||
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 :) | |
28 | */ | |
29 | #include <assert.h> | |
30 | #include <ctype.h> | |
31 | #include <errno.h> | |
32 | #include <limits.h> | |
33 | #include <setjmp.h> | |
34 | #include <signal.h> | |
35 | #include <stdarg.h> | |
36 | #include <stddef.h> | |
37 | #include <stdio.h> | |
38 | #include <stdlib.h> | |
39 | #include <string.h> | |
40 | ||
41 | #ifdef TIME_WITH_SYS_TIME | |
42 | # include <sys/time.h> | |
43 | # include <time.h> | |
44 | #else | |
45 | # ifdef HAVE_SYS_TIME_H | |
46 | # include <sys/time.h> | |
47 | # else | |
48 | # include <time.h> | |
49 | # endif | |
50 | #endif | |
51 | ||
52 | #ifdef HAVE_SYS_TYPES_H | |
53 | #include <sys/types.h> | |
54 | #endif | |
55 | ||
2f61d1d7 | 56 | #ifdef HAVE_SYS_SOCKET_H |
57 | #include <sys/socket.h> | |
58 | #endif | |
59 | ||
60 | #ifdef HAVE_NETDB_H | |
61 | #include <netdb.h> | |
62 | #endif | |
63 | ||
d76ed9a9 AS |
64 | #ifdef HAVE_UNISTD_H |
65 | #include <unistd.h> | |
66 | #endif | |
67 | ||
68 | #ifdef HAVE_VA_COPY | |
69 | #define VA_COPY(DEST, SRC) va_copy(DEST, SRC) | |
70 | #elif HAVE___VA_COPY | |
71 | #define VA_COPY(DEST, SRC) __va_copy(DEST, SRC) | |
72 | #else | |
73 | #define VA_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof(DEST)) | |
74 | #endif | |
75 | ||
76 | #ifndef HAVE_GETTIMEOFDAY | |
77 | extern int gettimeofday(struct timeval * tv, struct timezone * tz); | |
78 | #endif | |
79 | ||
80 | #ifndef HAVE_MEMCPY | |
81 | /* this should use size_t, but some systems don't define it */ | |
82 | extern void * memcpy(void * dest, void const * src, unsigned long n); | |
83 | #endif | |
84 | ||
85 | #ifndef HAVE_MEMSET | |
86 | /* this should use size_t, but some systems don't define it */ | |
87 | extern void * memset(void * dest, int c, unsigned long n); | |
88 | #endif | |
89 | ||
90 | #ifndef HAVE_STRDUP | |
91 | extern char * strdup(char const * str); | |
92 | #endif | |
93 | ||
94 | #ifndef HAVE_STRERROR | |
95 | extern char const * strerror(int errornum); | |
96 | #endif | |
97 | ||
2f61d1d7 | 98 | #ifndef HAVE_STRUCT_ADDRINFO |
99 | ||
100 | struct addrinfo { | |
101 | int ai_flags; | |
102 | int ai_family; | |
103 | int ai_socktype; | |
104 | int ai_protocol; | |
105 | size_t ai_addrlen; | |
106 | struct sockaddr *ai_addr; | |
107 | char *ai_canonname; | |
108 | struct addrinfo *ai_next; | |
109 | }; | |
110 | ||
111 | #define AI_PASSIVE 1 | |
112 | #define AI_CANONNAME 2 | |
1136f709 | 113 | #define AI_NUMERICHOST 4 |
2f61d1d7 | 114 | |
115 | #endif /* !defined(HAVE_STRUCT_ADDRINFO) */ | |
116 | ||
117 | #ifndef HAVE_GETADDRINFO | |
118 | ||
119 | int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); | |
120 | int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags); | |
121 | void freeaddrinfo(struct addrinfo *res); | |
122 | ||
123 | #endif | |
124 | ||
1136f709 | 125 | #ifndef SIGCHLD |
126 | # define SIGCHLD SIGCLD | |
127 | #endif | |
128 | ||
d76ed9a9 | 129 | #endif /* COMPAT_H */ |