if test "$PHP_HTTP" != "no"; then
+dnl -------
+dnl NETDB.H
+dnl -------
+
+ AC_MSG_CHECKING(for netdb.h)
+ if test -r /usr/include/netdb.h -o -r /usr/local/include/netdb.h; then
+ AC_DEFINE(HAVE_NETDB_H, 1, [Have netdb.h])
+ AC_MSG_RESULT(found in default path)
+ else
+ AC_MSG_RESULT(not found in default path)
+ fi
+
dnl ----
dnl CURL
dnl ----
#endif
#include <ctype.h>
-#include <netdb.h>
+
+#ifdef PHP_WIN32
+# include <winsock2.h>
+#elif defined(HAVE_NETDB_H)
+# include <netdb.h>
+#endif
#include "php.h"
#include "php_version.h"
const char *host, size_t host_len,
unsigned port TSRMLS_DC)
{
-#ifdef ZEND_ENGINE_2
+#if defined(PHP_WIN32) || defined(HAVE_NETDB_H)
struct servent *se;
#endif
php_url *purl, furl = {NULL};
furl.scheme = scheme = estrdup(proto);
} else if (purl->scheme) {
furl.scheme = purl->scheme;
-#ifdef ZEND_ENGINE_2
+#if defined(PHP_WIN32) || defined(HAVE_NETDB_H)
} else if (port && (se = getservbyport(port, "tcp"))) {
furl.scheme = (scheme = estrdup(se->s_name));
#endif
} else if (purl->port) {
furl.port = purl->port;
} else if (strncmp(furl.scheme, "http", 4)) {
-#ifdef ZEND_ENGINE_2
+#if defined(PHP_WIN32) || defined(HAVE_NETDB_H)
if (se = getservbyname(furl.scheme, "tcp")) {
furl.port = se->s_port;
} else