xref: /PHP-5.5/ext/sockets/config.m4 (revision 78f69a2b)
1dnl
2dnl $Id$
3dnl
4
5PHP_ARG_ENABLE(sockets, whether to enable sockets support,
6[  --enable-sockets        Enable sockets support])
7
8if test "$PHP_SOCKETS" != "no"; then
9  dnl Check for struct cmsghdr
10  AC_CACHE_CHECK([for struct cmsghdr], ac_cv_cmsghdr,
11  [
12    AC_TRY_COMPILE([
13#include <sys/types.h>
14#include <sys/socket.h>], [struct cmsghdr s; s], ac_cv_cmsghdr=yes, ac_cv_cmsghdr=no)
15  ])
16
17  if test "$ac_cv_cmsghdr" = yes; then
18    AC_DEFINE(HAVE_CMSGHDR,1,[Whether you have struct cmsghdr])
19  fi
20
21  AC_CHECK_FUNCS([hstrerror socketpair if_nametoindex if_indextoname])
22  AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h sys/sockio.h errno.h])
23  AC_TRY_COMPILE([
24#include <sys/types.h>
25#include <sys/socket.h>
26  ], [static struct msghdr tp; int n = (int) tp.msg_flags; return n],[],
27    [AC_DEFINE(MISSING_MSGHDR_MSGFLAGS, 1, [ ])]
28  )
29  AC_DEFINE([HAVE_SOCKETS], 1, [ ])
30
31  dnl Check for fied ss_family in sockaddr_storage (missing in AIX until 5.3)
32  AC_CACHE_CHECK([for field ss_family in struct sockaddr_storage], ac_cv_ss_family,
33  [
34    AC_TRY_COMPILE([
35#include <sys/socket.h>
36#include <sys/types.h>
37#include <netdb.h>
38  ], [struct sockaddr_storage sa_store; sa_store.ss_family = AF_INET6;],
39     ac_cv_ss_family=yes, ac_cv_ss_family=no)
40  ])
41
42  if test "$ac_cv_ss_family" = yes; then
43    AC_DEFINE(HAVE_SA_SS_FAMILY,1,[Whether you have sockaddr_storage.ss_family])
44  fi
45
46  dnl Check for AI_V4MAPPED flag
47  AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ac_cv_gai_ai_v4mapped],
48  [
49    AC_TRY_COMPILE([
50#include <netdb.h>
51  ], [int flag = AI_V4MAPPED;],
52     ac_cv_gai_ai_v4mapped=yes, ac_cv_gai_ai_v4mapped=no)
53  ])
54
55  if test "$ac_cv_gai_ai_v4mapped" = yes; then
56    AC_DEFINE(HAVE_AI_V4MAPPED,1,[Whether you have AI_V4MAPPED])
57  fi
58
59  PHP_NEW_EXTENSION([sockets], [sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c], [$ext_shared])
60  PHP_INSTALL_HEADERS([ext/sockets/], [php_sockets.h])
61fi
62