Enable and fix many extra warnings supported by GCC and Clang.
[tinc] / src / have.h
1 #ifndef TINC_HAVE_H
2 #define TINC_HAVE_H
3
4 /*
5     have.h -- include headers which are known to exist
6     Copyright (C) 1998-2005 Ivo Timmermans
7                   2003-2021 Guus Sliepen <guus@tinc-vpn.org>
8
9     This program is free software; you can redistribute it and/or modify
10     it under the terms of the GNU General Public License as published by
11     the Free Software Foundation; either version 2 of the License, or
12     (at your option) any later version.
13
14     This program is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU General Public License for more details.
18
19     You should have received a copy of the GNU General Public License along
20     with this program; if not, write to the Free Software Foundation, Inc.,
21     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24 #ifdef HAVE_MINGW
25 #define WINVER 0x0600
26 #define _WIN32_WINNT 0x0600
27 #define WIN32_LEAN_AND_MEAN
28 #endif
29
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <stdarg.h>
33 #include <stdbool.h>
34 #include <string.h>
35 #include <ctype.h>
36 #include <signal.h>
37 #include <errno.h>
38 #include <fcntl.h>
39 #include <unistd.h>
40 #include <limits.h>
41 #include <math.h>
42 #include <time.h>
43
44 #ifdef HAVE_MINGW
45 #include <w32api.h>
46 #include <winsock2.h>
47 #include <windows.h>
48 #include <ws2tcpip.h>
49 #endif
50
51 #ifdef HAVE_TERMIOS_H
52 #include <termios.h>
53 #endif
54
55 #ifdef HAVE_INTTYPES_H
56 #include <inttypes.h>
57 #endif
58
59 /* Include system specific headers */
60
61 #ifdef HAVE_STDDEF_H
62 #include <stddef.h>
63 #endif
64
65 #ifdef HAVE_SYSLOG_H
66 #include <syslog.h>
67 #endif
68
69 #ifdef HAVE_SYS_TIME_H
70 #include <sys/time.h>
71 #endif
72
73
74 #ifdef HAVE_SYS_TYPES_H
75 #include <sys/types.h>
76 #endif
77
78 #ifdef HAVE_SYS_STAT_H
79 #include <sys/stat.h>
80 #endif
81
82 #ifdef HAVE_SYS_FILE_H
83 #include <sys/file.h>
84 #endif
85
86 #ifdef HAVE_SYS_WAIT_H
87 #include <sys/wait.h>
88 #endif
89
90 #ifdef HAVE_SYS_IOCTL_H
91 #include <sys/ioctl.h>
92 #endif
93
94 #ifdef HAVE_SYS_PARAM_H
95 #include <sys/param.h>
96 #endif
97
98 #ifdef HAVE_SYS_RESOURCE_H
99 #include <sys/resource.h>
100 #endif
101
102 #ifdef HAVE_SYS_UN_H
103 #include <sys/un.h>
104 #endif
105
106 #ifdef HAVE_DIRENT_H
107 #include <dirent.h>
108 #endif
109
110 /* SunOS really wants sys/socket.h BEFORE net/if.h,
111    and FreeBSD wants these lines below the rest. */
112
113 #ifdef HAVE_NETDB_H
114 #include <netdb.h>
115 #endif
116
117 #ifdef HAVE_SYS_SOCKET_H
118 #include <sys/socket.h>
119 #endif
120
121 #ifdef HAVE_NET_IF_H
122 #include <net/if.h>
123 #endif
124
125 #ifdef HAVE_NET_IF_TYPES_H
126 #include <net/if_types.h>
127 #endif
128
129 #ifdef HAVE_NET_IF_TUN_H
130 #include <net/if_tun.h>
131 #endif
132
133 #ifdef HAVE_NET_TUN_IF_TUN_H
134 #include <net/tun/if_tun.h>
135 #endif
136
137 #ifdef HAVE_NET_IF_TAP_H
138 #include <net/if_tap.h>
139 #endif
140
141 #ifdef HAVE_NET_TAP_IF_TAP_H
142 #include <net/tap/if_tap.h>
143 #endif
144
145 #ifdef HAVE_NETINET_IN_SYSTM_H
146 #include <netinet/in_systm.h>
147 #endif
148
149 #ifdef HAVE_NETINET_IN_H
150 #include <netinet/in.h>
151 #endif
152
153 #ifdef HAVE_ARPA_INET_H
154 #include <arpa/inet.h>
155 #endif
156
157 #ifdef HAVE_NETINET_IP_H
158 #include <netinet/ip.h>
159 #endif
160
161 #ifdef HAVE_NETINET_TCP_H
162 #include <netinet/tcp.h>
163 #endif
164
165 #ifdef HAVE_NETINET_IN6_H
166 #include <netinet/in6.h>
167 #endif
168
169 #ifdef HAVE_NETINET_IP6_H
170 #include <netinet/ip6.h>
171 #endif
172
173 #ifdef HAVE_NET_ETHERNET_H
174 #include <net/ethernet.h>
175 #endif
176
177 #ifdef HAVE_NET_IF_ARP_H
178 #include <net/if_arp.h>
179 #endif
180
181 #ifdef HAVE_NETINET_IP_ICMP_H
182 #include <netinet/ip_icmp.h>
183 #endif
184
185 #ifdef HAVE_NETINET_ICMP6_H
186 #include <netinet/icmp6.h>
187 #endif
188
189 #ifdef HAVE_NETINET_IF_ETHER_H
190 #include <netinet/if_ether.h>
191 #endif
192
193 #ifdef HAVE_ARPA_NAMESER_H
194 #include <arpa/nameser.h>
195 #endif
196
197 #ifdef HAVE_RESOLV_H
198 #include <resolv.h>
199 #endif
200
201 #ifdef HAVE_LINUX_IF_TUN_H
202 #include <linux/if_tun.h>
203 #endif
204
205 #ifdef HAVE_GETOPT_H
206 #include <getopt.h>
207 #else
208 #include "getopt.h"
209 #endif
210
211 #ifdef STATUS
212 #undef STATUS
213 #endif
214
215 #ifdef HAVE_MINGW
216 #define SLASH "\\"
217 #else
218 #define SLASH "/"
219 #endif
220
221 #endif