#endif
#endif
+/* Some MinGW version defines min() and max() as macros
+ causing the fail of the build process. The following
+ #define will disable that definition
+ */
+#if defined(__GNUC__)
+#define NOMINMAX
+#endif
+
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
# define __USE_FILE_OFFSET64 1
#endif
#undef ACL
-
-/** \cond AUTODOCS-IGNORE */
-using namespace Squid;
-/** \endcond */
-
-
-/* win32lib.c */
-SQUIDCEXTERN int chroot (const char *);
-SQUIDCEXTERN int ftruncate(int, off_t);
-#ifndef HAVE_GETTIMEOFDAY
-SQUIDCEXTERN int gettimeofday(struct timeval * ,void *);
-#endif
-SQUIDCEXTERN int kill(pid_t, int);
-SQUIDCEXTERN int statfs(const char *, struct statfs *);
-SQUIDCEXTERN int truncate(const char *, off_t);
-SQUIDCEXTERN const char * wsastrerror(int);
-SQUIDCEXTERN struct passwd *getpwnam(char *);
-SQUIDCEXTERN struct group *getgrnam(char *);
-SQUIDCEXTERN uid_t geteuid(void);
-SQUIDCEXTERN uid_t getuid(void);
-SQUIDCEXTERN int setuid(uid_t);
-SQUIDCEXTERN int seteuid(uid_t);
-SQUIDCEXTERN gid_t getgid(void);
-SQUIDCEXTERN gid_t getegid(void);
-SQUIDCEXTERN int setgid(gid_t);
-SQUIDCEXTERN int setegid(gid_t);
-SQUIDCEXTERN const char *WIN32_strerror(int);
-SQUIDCEXTERN void WIN32_maperror(unsigned long);
-
-// Moved in from squid.h and other duplicates.
-// BUT was already included up the top there with a wrapped conditional.
-// that may need checking....
-//#include <io.h>
-
-/* Windows may lack getpagesize() prototype */
-// Moved in from squid.h
-// NP: there may be a header include needed before this to prevent duplicate-definitions
-// if that is true it will need including here as part of the hack.
-// if not then this comment can be dropped.
-#if !defined(getpagesize)
-SQUIDCEXTERN size_t getpagesize(void);
-#endif
-
-
#endif /* _SQUID_WIN32_ */
#endif /* SQUID_OS_MSWIN_H */
#define _SQUID_WIN32_
#elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
-#define _SQUID_MSWIN_
+/* We are using _SQUID_MSWIN_ define in cf.data.pre, so
+ it must be defined to 1 to avoid the build failure of cfgen.
+ */
+#define _SQUID_MSWIN_ 1
#define _SQUID_WIN32_
#elif defined(__APPLE__)
WSAStartup(2, &wsaData);
#endif
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
- if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
+ if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) exit(1);
WSACleanup();
+#else
+ if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
#endif
if (val<=0) exit(1);
fp = fopen("conftestval", "w");
WSAStartup(2, &wsaData);
#endif
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
- if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
+ if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) exit(1);
WSACleanup();
+#else
+ if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
#endif
if (val <= 0) exit(1);
fp = fopen("conftestval", "w");
WSAStartup(2, &wsaData);
#endif
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
- if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
+ if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) exit(1);
WSACleanup();
+#else
+ if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
#endif
if (val <= 0) exit(1);
fp = fopen("conftestval", "w");
WSAStartup(2, &wsaData);
#endif
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
- if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
+ if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) exit(1);
WSACleanup();
+#else
+ if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
#endif
if (val <= 0) exit(1);
fp = fopen("conftestval", "w");
int result = NTV_SERVER_ERROR;
size_t i;
char NTDomain[256];
- char *domain_qualify;
+ char *domain_qualify = NULL;
char DomainUser[256];
char User[256];
squid_LDADD = \
$(COMMON_LIBS) \
icmp/libicmp.la icmp/libicmp-core.la \
+ ../compat/libcompat.la \
-L../lib \
@XTRA_OBJS@ \
@DISK_LINKOBJS@ \
aclMatchArp(SplayNode<acl_arp_data *> **dataptr, IpAddress &c)
{
struct arpreq arpReq;
+#if !defined(_SQUID_WIN32_)
struct sockaddr_in *sa = NULL;
+#endif
IpAddress ipAddr = c;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA_INTERFACES, 0, KEY_READ, &hndKey) == ERROR_SUCCESS) {
int i;
- int MaxSubkeyLen;
- DWORD InterfacesCount;
+ DWORD MaxSubkeyLen, InterfacesCount;
char *keyname;
FILETIME ftLastWriteTime;
if (RegQueryInfoKey(hndKey, NULL, NULL, NULL, &InterfacesCount, &MaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
keyname = (char *) xmalloc(++MaxSubkeyLen);
for (i = 0; i < (int) InterfacesCount; i++) {
- int j;
+ DWORD j;
j = MaxSubkeyLen;
if (RegEnumKeyEx(hndKey, i, keyname, &j, NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) {
char *newkeyname;
Result = RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, NULL, &Size);
if (Result == ERROR_SUCCESS && Size) {
t = (char *) xmalloc(Size);
- RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, t, &Size);
+ RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, (LPBYTE)t, &Size);
token = strtok(t, ", ");
while (token) {
debugs(78, 1, "Adding DHCP nameserver " << token << " from Registry");
Result = RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, NULL, &Size);
if (Result == ERROR_SUCCESS && Size) {
t = (char *) xmalloc(Size);
- RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, t, &Size);
+ RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, (LPBYTE)t, &Size);
token = strtok(t, ", ");
while (token) {
debugs(78, 1, "Adding nameserver " << token << " from Registry");
}
/// unsafe main routine -- may throw
-static int SquidMain(int argc, char **argv);
+int SquidMain(int argc, char **argv);
/// unsafe main routine wrapper to catch exceptions
static int SquidMainSafe(int argc, char **argv);
return -1; // not reached
}
-static int
+int
SquidMain(int argc, char **argv)
{
#ifdef _SQUID_WIN32_
void
CacheManager::registerAction(char const * action, char const * desc, OBJH * handler, int pw_req_flag, int atomic) {}
+/* MinGW needs also a stub of death() */
+void
+death(int sig)
+{
+ std::cout << "Fatal: Signal " << sig;
+ exit (1);
+}
+
/* end stub functions */