/*
have.h -- include headers which are known to exist
Copyright (C) 1998-2005 Ivo Timmermans
- 2003-2016 Guus Sliepen <guus@tinc-vpn.org>
+ 2003-2021 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
#ifdef HAVE_MINGW
-#define WINVER WindowsXP
+#define WINVER 0x0600
+#define _WIN32_WINNT 0x0600
#define WIN32_LEAN_AND_MEAN
+#define _CRT_SECURE_NO_WARNINGS
+#define _CRT_NONSTDC_NO_WARNINGS
#endif
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <limits.h>
#include <math.h>
#include <time.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#elif defined(HAVE_NETBSD)
+#define alloca(size) __builtin_alloca(size)
+#endif
+
#ifdef HAVE_MINGW
+#ifdef HAVE_W32API_H
#include <w32api.h>
+#endif
+
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
+
+#ifdef _MSC_VER
+#include <io.h>
+#include <process.h>
+#include <direct.h>
#endif
+#endif // HAVE_MINGW
#ifdef HAVE_TERMIOS_H
#include <termios.h>
/* Include system specific headers */
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
#include <sys/file.h>
#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
+#elif defined(_MSC_VER)
+#include "dirent.h"
#endif
/* SunOS really wants sys/socket.h BEFORE net/if.h,