summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/sockets/config.m45
-rw-r--r--ext/sockets/php_sockets.h2
-rw-r--r--ext/sockets/sockets.c4
3 files changed, 7 insertions, 4 deletions
diff --git a/ext/sockets/config.m4 b/ext/sockets/config.m4
index e88b54ecda..91dda989c8 100644
--- a/ext/sockets/config.m4
+++ b/ext/sockets/config.m4
@@ -18,7 +18,7 @@ if test "$PHP_SOCKETS" != "no"; then
AC_DEFINE(HAVE_CMSGHDR,1,[Whether you have struct cmsghdr])
fi
- AC_CHECK_FUNCS([hstrerror])
+ AC_CHECK_FUNCS([hstrerror socketpair])
AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h errno.h])
AC_TRY_COMPILE([
#include <sys/types.h>
@@ -30,6 +30,3 @@ if test "$PHP_SOCKETS" != "no"; then
PHP_NEW_EXTENSION([sockets], [sockets.c], [$ext_shared])
fi
-
-PHP_CHECK_FUNC(gethostbyname2)
-
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index b89f4f6eb4..657f4276b2 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -45,7 +45,9 @@ PHP_RSHUTDOWN_FUNCTION(sockets);
PHP_FUNCTION(socket_select);
PHP_FUNCTION(socket_create_listen);
+#ifdef HAVE_SOCKETPAIR
PHP_FUNCTION(socket_create_pair);
+#endif
PHP_FUNCTION(socket_accept);
PHP_FUNCTION(socket_set_nonblock);
PHP_FUNCTION(socket_set_block);
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 5ec6d53aa9..63177b1334 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -117,7 +117,9 @@ zend_function_entry sockets_functions[] = {
PHP_FE(socket_select, first_through_third_args_force_ref)
PHP_FE(socket_create, NULL)
PHP_FE(socket_create_listen, NULL)
+#ifdef HAVE_SOCKETPAIR
PHP_FE(socket_create_pair, fourth_arg_force_ref)
+#endif
PHP_FE(socket_accept, NULL)
PHP_FE(socket_set_nonblock, NULL)
PHP_FE(socket_set_block, NULL)
@@ -1726,6 +1728,7 @@ PHP_FUNCTION(socket_set_option)
}
/* }}} */
+#ifdef HAVE_SOCKETPAIR
/* {{{ proto bool socket_create_pair(int domain, int type, int protocol, array &fd) U
Creates a pair of indistinguishable sockets and stores them in fds. */
PHP_FUNCTION(socket_create_pair)
@@ -1786,6 +1789,7 @@ PHP_FUNCTION(socket_create_pair)
RETURN_TRUE;
}
/* }}} */
+#endif
#ifdef HAVE_SHUTDOWN
/* {{{ proto bool socket_shutdown(resource socket[, int how]) U