Simon Josefsson wrote: > My problem is getting > AC_SEARCH_LIBS to find functions in the mingw32 libraries. It seems a > __stdcall is required in the prototype to make it link correctly.
The prototype with __stdcall must be contained in a public include file, no? (<winsock2.h>, included by your <sys/socket.h> substitute.) It seems you will have to write a test that 1) tries to use gethostbyname() with the #include and no additional libraries, 2) same thing with -lwsock32, and set some LIB* or *_LDFLAGS variable, depending on the result. Look how AM_ICONV_LINK (in gethostbyname.m4) does it; something like this: AC_CACHE_CHECK(for gethostbyname, gl_cv_func_gethostbyname, [ gl_cv_func_gethostbyname=no gl_cv_lib_gethostbyname=no AC_TRY_LINK([ #if HAVE_SYS_SOCKET_H # include <sys/socket.h> #elif HAVE_WINSOCK2_H # include <winsock2.h> #endif], [gethostbyname("");], gl_cv_func_gethostbyname=yes) if test "$gl_cv_func_gethostbyname" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS -lwsock32" AC_TRY_LINK([ #if HAVE_SYS_SOCKET_H # include <sys/socket.h> #elif HAVE_WINSOCK2_H # include <winsock2.h> #endif], [gethostbyname("");], gl_cv_lib_gethostbyname=yes gl_cv_func_gethostbyname=yes) LIBS="$am_save_LIBS" fi ]) Bruno _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib