From: Guilhem Lavaux Date: Tue, 10 Aug 1999 17:48:11 +0000 (+0000) Subject: Check for inet_addr/inet_aton. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e96ac54e83bac9f840dcc972bb6615e13bc9f31b?ds=sidebyside Check for inet_addr/inet_aton. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/configure.in b/configure.in index fa87fbf381..0e894f9e05 100644 --- a/configure.in +++ b/configure.in @@ -1333,6 +1333,10 @@ AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP), [ dnl check for uname (POSIX) and gethostname (BSD) AC_CHECK_FUNCS(uname gethostname, break) +dnl check for inet_addr, inet_aton, ... +AC_CHECK_FUNCS(inet_addr) +AC_CHECK_FUNCS(inet_aton) + dnl =========================================================================== dnl Now we have all the info we need - use it! dnl =========================================================================== diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c index c860fca201..541ab46929 100644 --- a/src/unix/gsocket.c +++ b/src/unix/gsocket.c @@ -972,7 +972,15 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname) addr = &(((struct sockaddr_in *)address->m_addr)->sin_addr); /* If it is a numeric host name, convert it now */ +#if HAVE_INET_ATON if (inet_aton(hostname, addr) == 0) { +#elif HAVE_INET_ADDR + /* Fix from Guillermo Rodriguez Garcia */ + if ( (addr->s_addr = inet_addr(hostname)) == -1 ) { +#else + /* Use gethostbyname by default */ + if (1) { +#endif struct in_addr *array_addr; /* It is a real name, we solve it */