[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getaddrinfo: finding gethostbyname in mingw32

From: Bruno Haible
Subject: Re: getaddrinfo: finding gethostbyname in mingw32
Date: Wed, 18 Jan 2006 15:46:07 +0100
User-agent: KMail/1.5

Simon Josefsson wrote:
>   AC_SEARCH_LIBS(gethostbyname, [inet nsl])
> ...
>   if test "$ac_cv_search_gethostbyname" = "no"; then
>     save_LIBS="$LIBS"
>     LIBS="$LIBS -lwsock32"
>     AC_MSG_CHECKING([whether we need -lwsock32])
>       AC_LANG_PROGRAM([[
> #include <ws2tcpip.h>

Why do you include <ws2tcpip.h>, when the declaration is actually in
<winsock2.h>? (At least it is in the mingw version I'm looking at.)

> ]], [gethostbyname ("foo");])],
>       need_wsock32=yes, need_wsock32=no)
>     AC_MSG_RESULT($need_wsock32)
>     LIBS="$save_LIBS"
>     if test "$need_wsock32" = "yes"; then
>       LIBS="$LIBS -lwsock32"
>     fi
>   fi
> However, it seems rather ugly.

No, it's fine: It adds to LIBS only what is needed. It works when
cross-compiling. It uses the same technique as AC_SEARCH_LIBS.

> I was hoping to be able to connect to
> the AC_SEARCH_LIB logic somehow

You are only working around the lack of a #includes section argument
in the AC_SEARCH_LIBS macro.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]