moriyoshi               Fri Apr  4 13:40:38 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/ext/sockets   config.m4 sockets.c 
  Log:
  MFH: added check for struct cmsghdr. now sockets extension can be built
  under cygwin
  
  
Index: php4/ext/sockets/config.m4
diff -u php4/ext/sockets/config.m4:1.11 php4/ext/sockets/config.m4:1.11.2.1
--- php4/ext/sockets/config.m4:1.11     Wed Sep  4 10:30:36 2002
+++ php4/ext/sockets/config.m4  Fri Apr  4 13:40:38 2003
@@ -1,11 +1,22 @@
 dnl
-dnl $Id: config.m4,v 1.11 2002/09/04 14:30:36 sniper Exp $
+dnl $Id: config.m4,v 1.11.2.1 2003/04/04 18:40:38 moriyoshi Exp $
 dnl
 
 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: php4/ext/sockets/sockets.c
diff -u php4/ext/sockets/sockets.c:1.125.2.10 php4/ext/sockets/sockets.c:1.125.2.11
--- php4/ext/sockets/sockets.c:1.125.2.10       Fri Apr  4 09:18:31 2003
+++ php4/ext/sockets/sockets.c  Fri Apr  4 13:40:38 2003
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: sockets.c,v 1.125.2.10 2003/04/04 14:18:31 moriyoshi Exp $ */
+/* $Id: sockets.c,v 1.125.2.11 2003/04/04 18:40:38 moriyoshi Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -140,7 +140,9 @@
        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 @@
 
 /* {{{ 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 @@
                RETURN_FALSE;
        }
 }
+#endif
 /* }}} */
 
 /* {{{ proto bool socket_sendmsg(resource socket, resource iovec, int flags, string 
addr [, int port])



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to