>>>>"Mark" == Mark Brand <[EMAIL PROTECTED]> writes:
>>>>        
>
>[...]
>
> Mark> <configure.ac>
> Mark> if test x$target_os == xmingw32; then
> Mark> WINSOCK=-lws2_32
> Mark> fi
> Mark> AC_SUBST(WINSOCK)
> Mark> </configure.ac>
>
>Eww.  That would be $host, not $target, and anyway testing the
>host type should always be your last resort.  Why not test for
>the presence of the ws2_32 library and use it if it's there ?
>
>Here is a possible check assuming adding -lws2_32 to LIBS is OK
>(but it's easy to define WINSOCK as above if you prefer).
>
>
>AC_SEARCH_LIBS([gethostbyname], [nsl socket], [], [
>dnl Can't search ws2_32 for gethostbyname using AC_SEARCH_LIBS, because
>dnl it requires #include <winsocks2.h> to work.
>my_old_LIBS=$LIBS
>LIBS="-lws2_32 $LIBS"
>ws2_res=yes
>AC_MSG_CHECKING([for gethostbyname in ws2_32])
>AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
>                                [[gethostbyname ("");]])],
>               [], [LIBS=$my_ac_save_LIBS ws2_res=no])
>AC_MSG_RESULT([$ws2_res])
>])
>  

I agree that this is a more elegant solution. Thanks.

"my_old_LIBS" and "my_ac_save_LIBS" were meant to be the same variable,
right?

Thanks. Even though "./configure --with-msw --target=i586-mingw32msvc
--host=i586-mingw32msvc --build=i386-linux" reports that  that it finds
gethostbyname in ws2_32, the generated Makefile has a line:

    LIBS =

I must be missing something obvious.


Mark


Reply via email to