miaozhiqiang / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

if win32 include definitions for winsock2.h and ws2tcpip.h and use libws2_32 instead of bsd sockets #376

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. build libevent with mingw-w64 x86_64-w64-mingw32 toolchain from mingw-builds
2. configure with $LIBS=-lws2_32 and attempt to build memcached
3. compilation fails because sys/socket.h, netinet/in.h and netinet/tcp.h are 
not found

What is the expected output? What do you see instead?
AC_CHECK_HEADERS in configure.ac checks for all BSD/*NIX versions of sockets 
and if WIN32 use #include <winsock2.h> and #include <ws2tcpip.h> instead

What version of the product are you using? On what operating system?
memcached-1.4.20

Please provide any additional information below.
I appreciate all the amazing work here! Thanks!

I cribbed theses lines from libevent:

AC_CHECK_HEADERS([netinet/in.h netinet/in6.h netdb.h netinet/tcp.h 
sys/socket.h])
AC_CHECK_TYPES([blah, blah], , ,
[#define _GNU_SOURCE
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_IN6_H
#include <netinet/in6.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef WIN32
#define WIN32_WINNT 0x400
#define _WIN32_WINNT 0x400
#define WIN32_LEAN_AND_MEAN
#if defined(_MSC_VER) && (_MSC_VER < 1300)
#include <winsock.h>
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#endif
])

Original issue reported on code.google.com by bwanama...@gmail.com on 22 Aug 2014 at 4:54

GoogleCodeExporter commented 8 years ago
We don't really support windows :(

Original comment by dorma...@rydia.net on 1 Jan 2015 at 6:18