From: Amos Jeffries Date: Tue, 13 Jan 2015 04:53:25 +0000 (-0800) Subject: Windows: auto-detect InetNtopA and InetPtonA X-Git-Tag: merge-candidate-3-v1~354 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dfb96b6be6b3dea2bc2488b43de143adfd985c6d;p=thirdparty%2Fsquid.git Windows: auto-detect InetNtopA and InetPtonA Also, add missing wrapper definition for inet_pton() --- diff --git a/compat/os/mswindows.h b/compat/os/mswindows.h index 0f31a2d52a..ab822ab92e 100644 --- a/compat/os/mswindows.h +++ b/compat/os/mswindows.h @@ -624,10 +624,25 @@ getsockopt(int s, int l, int o, void * v, socklen_t * n) inline char * inet_ntop(int af, const void *src, char *dst, size_t size) { +#if HAVE_DECL_INETNTOPA return (char*)InetNtopA(af, const_cast(src), dst, size); +#else + return xinet_ntop(af, src, dst, size); +#endif } #define inet_ntop(a,s,d,l) Squid::inet_ntop(a,s,d,l) +inline char * +inet_pton(int af, const void *src, char *dst) +{ +#if HAVE_DECL_INETPTONA + return (char*)InetPtonA(af, const_cast(src), dst); +#else + return xinet_pton(af, src, dst); +#endif +} +#define inet_pton(a,s,d) Squid::inet_pton(a,s,d) + /* Simple ioctl() emulation */ inline int ioctl(int s, int c, void * a) diff --git a/configure.ac b/configure.ac index 491c12bf02..ced3882953 100644 --- a/configure.ac +++ b/configure.ac @@ -3375,7 +3375,7 @@ AC_REPLACE_FUNCS(\ tempnam \ ) -AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton],,,[ +AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton,InetNtopA,InetPtonA],,,[ /* * BSD requires sys/types.h, sys/socket.h, netinet/in.h, netdb.h, arpa/inet.h * Linux requires sys/types.h, sys/socket.h, arpa/inet.h