]> granicus.if.org Git - php/commitdiff
MFH: added check for struct cmsghdr. now sockets extension can be built
authorMoriyoshi Koizumi <moriyoshi@php.net>
Fri, 4 Apr 2003 18:40:38 +0000 (18:40 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Fri, 4 Apr 2003 18:40:38 +0000 (18:40 +0000)
under cygwin

ext/sockets/config.m4
ext/sockets/sockets.c

index ed5a318f2114bc9fe158e7f239d884ae24253c55..1509dd80cb1fd5dd599e835405eff325ab241b51 100644 (file)
@@ -6,6 +6,17 @@ PHP_ARG_ENABLE(sockets, whether to enable sockets support,
 [  --enable-sockets        Enable sockets support])
 
 if test "$PHP_SOCKETS" != "no"; then
+  dnl Check for struct cmsghdr
+  AC_CACHE_CHECK([for struct cmsghdr], ac_cv_cmsghdr,
+  [
+    AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>], [struct cmsghdr s; s], ac_cv_cmsghdr=yes, ac_cv_cmsghdr=no)
+  ])
+
+  if test "$ac_cv_cmsghdr" = yes; then
+    AC_DEFINE(HAVE_CMSGHDR,1,[Whether you have struct cmsghdr])
+  fi 
 
   AC_CHECK_FUNCS([hstrerror])
   AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h errno.h])
index a63a38845192ba9c691a0c1fd8c30cf77a412a76..9cc5120b3ddf4e81954343662315c23fa165395f 100644 (file)
@@ -140,7 +140,9 @@ function_entry sockets_functions[] = {
        PHP_FE(socket_send,                             NULL)
        PHP_FE(socket_recvfrom,                 second_fifth_and_sixth_args_force_ref)
        PHP_FE(socket_sendto,                   NULL)
+#ifdef HAVE_CMSGHDR
        PHP_FE(socket_recvmsg,                  third_through_seventh_args_force_ref)
+#endif
        PHP_FE(socket_sendmsg,                  NULL)
        PHP_FE(socket_readv,                    NULL)
        PHP_FE(socket_writev,                   NULL)
@@ -1546,6 +1548,7 @@ PHP_FUNCTION(socket_sendto)
 
 /* {{{ proto bool socket_recvmsg(resource socket, resource iovec, array &control, int &controllen, int &flags, string &addr [, int &port])
    Used to receive messages on a socket, whether connection-oriented or not */
+#ifdef HAVE_CMSGHDR
 PHP_FUNCTION(socket_recvmsg)
 {
        zval                                    *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7 = NULL;
@@ -1693,6 +1696,7 @@ PHP_FUNCTION(socket_recvmsg)
                RETURN_FALSE;
        }
 }
+#endif
 /* }}} */
 
 /* {{{ proto bool socket_sendmsg(resource socket, resource iovec, int flags, string addr [, int port])