Commit 76df598b authored by David Woodhouse's avatar David Woodhouse

Add compatibility inet_aton() function for MinGW build

Based on a patch from Nikos Mavrogiannopoulos.
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 1f34d35c
......@@ -190,3 +190,11 @@ void openconnect__unsetenv(const char *name)
putenv(buf);
}
#endif
#ifndef HAVE_INET_ATON
int openconnect__inet_aton(const char *cp, struct in_addr *addr)
{
addr->s_addr = inet_addr(cp);
return (addr->s_addr == 0xffffffff) ? 0 : 1;
}
#endif
......@@ -141,7 +141,13 @@ AS_COMPILER_FLAGS(WFLAGS,
AC_SUBST(WFLAGS, [$WFLAGS])
AC_CHECK_FUNC(socket, [], AC_CHECK_LIB(socket, socket, [], AC_ERROR(Cannot find socket() function)))
AC_CHECK_FUNC(inet_aton, [], AC_CHECK_LIB(nsl, inet_aton, [], AC_ERROR(Cannot find inet_aton() function)))
have_inet_aton=yes
AC_CHECK_FUNC(inet_aton, [], AC_CHECK_LIB(nsl, inet_aton, [], have_inet_aton=no))
if test "$have_inet_aton" = "yes"; then
AC_DEFINE(HAVE_INET_ATON, 1)
fi
AC_CHECK_FUNC(__android_log_vprint, [], AC_CHECK_LIB(log, __android_log_vprint, [], []))
AC_CHECK_FUNCS(setenv unsetenv)
......
......@@ -364,6 +364,11 @@ int openconnect__setenv(const char *name, const char *value, int overwrite);
void openconnect__unsetenv(const char *name);
#endif
#ifndef HAVE_INET_ATON
#define inet_aton openconnect__inet_aton
int openconnect__inet_aton(const char *cp, struct in_addr *addr);
#endif
/* I always coded as if it worked like this. Now it does. */
#define realloc_inplace(p, size) do { \
void *__realloc_old = p; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment