From ffe8303f24bd1db8af1e64e99c9f7edca4940d95 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 20 May 2012 19:37:20 -0300 Subject: [PATCH] - Fixed bug #62025 (__ss_family was changed on AIX 5.3) --- ext/sockets/config.m4 | 15 +++++++++++++++ ext/sockets/sockets.c | 3 +++ 2 files changed, 18 insertions(+) diff --git a/ext/sockets/config.m4 b/ext/sockets/config.m4 index 3fb93aec70..4032621ce6 100644 --- a/ext/sockets/config.m4 +++ b/ext/sockets/config.m4 @@ -27,6 +27,21 @@ if test "$PHP_SOCKETS" != "no"; then [AC_DEFINE(MISSING_MSGHDR_MSGFLAGS, 1, [ ])] ) AC_DEFINE([HAVE_SOCKETS], 1, [ ]) + + dnl Check for fied ss_family in sockaddr_storage (missing in AIX until 5.3) + AC_CACHE_CHECK([for field ss_family in struct sockaddr_storage], ac_cv_ss_family, + [ + AC_TRY_COMPILE([ +#include +#include +#include + ], [struct sockaddr_storage sa_store; sa_store.ss_family = AF_INET6;], + ac_cv_ss_family=yes, ac_cv_ss_family=no) + ]) + + if test "$ac_cv_ss_family" = yes; then + AC_DEFINE(HAVE_SA_SS_FAMILY,1,[Whether you have sockaddr_storage.ss_family]) + fi PHP_NEW_EXTENSION([sockets], [sockets.c multicast.c], [$ext_shared]) PHP_INSTALL_HEADERS([ext/sockets/], [php_sockets.h]) diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 46d9f8e1b8..586376798f 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -77,6 +77,9 @@ # define IS_INVALID_SOCKET(a) (a->bsd_socket < 0) # define set_errno(a) (errno = a) # include "php_sockets.h" +# if defined(AIX) && !defined(HAVE_SA_SS_FAMILY) +# define ss_family __ss_family +# endif # if HAVE_IF_NAMETOINDEX # include # endif -- 2.40.0