The obvious way to detect that you're on MinGW and you need to stick -lws2_32 on your link line for 'ntohl' is AC_SEARCH_LIBS([ntohl], [ws2_32]) but this does not work, because the system declares ntohl as WINSOCK_API_LINKAGE u_long PASCAL ntohl(u_long); whereas AC_LANG_CALL will declare it as char ntohl(); On Windows the former gets the symbol name '_ntohl@4' and the latter just '_ntohl', which means both link attempts will fail. There's no way autoconf can be expected to know this, it has to include the appropriate system header. Worse, the "appropriate system header" is different on Windows than on Unixy platforms. Thus, to get it right everywhere, the program compiled needs to be something like this: AC_LANG_CONFTEST([AC_LANG_PROGRAM( [#ifdef _WIN32 #include <winsock2.h> #else #include <arpa/inet.h> #endif], [return (int)ntohl(42);])]) Is there a neater way to do this test than by copying the entire definition of AC_SEARCH_LIBS into my configure.ac (or my aclocal.m4) and hacking it up? Thanks, zw _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf