Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -141,10 +141,12 @@ ]) LIBS="${save_LIBS}" ]) if test "x$nanotcl_cv_func_CryptGenRandom" = 'xyes'; then LIBS="${LIBS} -ladvapi32" + AC_DEFINE(HAVE_WINDOWS_H, [1], [Define if we have ]) + AC_DEFINE(HAVE_WINCRYPT_H, [1], [Define if we have ]) AC_DEFINE(HAVE_CRYPTGENRANDOM, [1], [Define if we have CryptGenRandom]) fi ]) ]) @@ -151,10 +153,39 @@ dnl Check for name resolution capabilities AC_CHECK_FUNCS(getaddrinfo, [ AC_CHECK_FUNCS(getnameinfo, [ AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) ]) +], [ + AC_CACHE_CHECK([for getaddrinfo on Windows], nanotcl_cv_func_getaddrinfo, [ + save_LIBS="${LIBS}" + LIBS="${save_LIBS} -lws2_32" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#include + ]], [[ + int gai_ret; + gai_ret = getaddrinfo(NULL, NULL, NULL, NULL); + if (gai_ret == 0) { + return(1); + } else { + return(0); + } + ]])], [ + nanotcl_cv_func_getaddrinfo='yes' + ], [ + nanotcl_cv_func_getaddrinfo='no' + ]) + LIBS="${save_LIBS}" + ]) + if test "x$nanotcl_cv_func_getaddrinfo" = 'xyes'; then + LIBS="${LIBS} -lws2_32" + AC_DEFINE(HAVE_GETADDRINFO, [1], [Define if we have getaddrinfo]) + AC_DEFINE(HAVE_GETNAMEINFO, [1], [Define if we have getnameinfo]) + AC_DEFINE(HAVE_WINDOWS_H, [1], [Define if we have ]) + AC_DEFINE(HAVE_WS2TCPIP_H, [1], [Define if we have ]) + fi ]) dnl Handle specifying where TCLLIB is, for testing AC_SUBST(TCLLIB_PATH) TCLLIB_PATH='/dev/null' Index: nano.c ================================================================== --- nano.c +++ nano.c @@ -1,7 +1,14 @@ /* XXX:TODO: OpenMP support is currently incomplete */ #undef NANO_TCL_HAVE_OPENMP + +#ifdef HAVE_WS2TCPIP_H +# include +#endif +#ifdef HAVE_WINDOWS_H +# include +#endif #include #include #include #include