AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
if test x$bwin32 = xtrue; then
- LIBS="$LIBS -lws2_32"
+ AC_SEARCH_LIBS([getservbyname],[ws2_32])
fi
dnl Checks for typedefs, structures, and compiler characteristics.
n = (int) strtol(servname, &endptr, 10);
if (n>=0 && n <= 65535 && servname[0] && endptr && !endptr[0])
return n;
-#ifdef _EVENT_HAVE_GETSERVBYNAME
+#if defined(_EVENT_HAVE_GETSERVBYNAME) || defined(WIN32)
if (!(hints->ai_flags & EVUTIL_AI_NUMERICSERV)) {
struct servent *ent = getservbyname(servname, protocol);
if (ent) {
r = evdns_getaddrinfo(dns_base, "1.2.3.4", "http",
&hints, gai_cb, &local_outcome);
tt_int_op(r,==,0);
- tt_int_op(local_outcome.err,==,0);
- tt_ptr_op(local_outcome.ai,!=,NULL);
- test_ai_eq(local_outcome.ai, "1.2.3.4:80", SOCK_STREAM, IPPROTO_TCP);
- evutil_freeaddrinfo(local_outcome.ai);
- local_outcome.ai = NULL;
+ if (!local_outcome.err) {
+ tt_ptr_op(local_outcome.ai,!=,NULL);
+ test_ai_eq(local_outcome.ai, "1.2.3.4:80", SOCK_STREAM, IPPROTO_TCP);
+ evutil_freeaddrinfo(local_outcome.ai);
+ local_outcome.ai = NULL;
+ } else {
+ TT_BLATHER(("Apparently we have no getservbyname."));
+ }
/* 1b. EVUTIL_AI_NUMERICHOST is set */
memset(&hints, 0, sizeof(hints));