xref: /PHP-7.4/ext/sockets/config.m4 (revision 53299d61)
1PHP_ARG_ENABLE([sockets],
2  [whether to enable sockets support],
3  [AS_HELP_STRING([--enable-sockets],
4    [Enable sockets support])])
5
6if test "$PHP_SOCKETS" != "no"; then
7  AC_CHECK_FUNCS([hstrerror if_nametoindex if_indextoname])
8  AC_CHECK_HEADERS([netinet/tcp.h sys/un.h sys/sockio.h])
9  AC_DEFINE([HAVE_SOCKETS], 1, [ ])
10
11  dnl Check for fied ss_family in sockaddr_storage (missing in AIX until 5.3)
12  AC_CACHE_CHECK([for field ss_family in struct sockaddr_storage], ac_cv_ss_family,
13  [
14    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
15#include <sys/socket.h>
16#include <sys/types.h>
17#include <netdb.h>
18  ]], [[struct sockaddr_storage sa_store; sa_store.ss_family = AF_INET6;]])],
19    [ac_cv_ss_family=yes], [ac_cv_ss_family=no])
20  ])
21
22  if test "$ac_cv_ss_family" = yes; then
23    AC_DEFINE(HAVE_SA_SS_FAMILY,1,[Whether you have sockaddr_storage.ss_family])
24  fi
25
26  dnl Check for AI_V4MAPPED flag
27  AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ac_cv_gai_ai_v4mapped],
28  [
29    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
30#include <netdb.h>
31  ]], [[int flag = AI_V4MAPPED;]])],
32    [ac_cv_gai_ai_v4mapped=yes], [ac_cv_gai_ai_v4mapped=no])
33  ])
34
35  if test "$ac_cv_gai_ai_v4mapped" = yes; then
36    AC_DEFINE(HAVE_AI_V4MAPPED,1,[Whether you have AI_V4MAPPED])
37  fi
38
39  dnl Check for AI_ALL flag
40  AC_CACHE_CHECK([if getaddrinfo supports AI_ALL],[ac_cv_gai_ai_all],
41  [
42    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
43#include <netdb.h>
44  ]], [[int flag = AI_ALL;]])],
45    [ac_cv_gai_ai_all=yes], [ac_cv_gai_ai_all=no])
46  ])
47
48  if test "$ac_cv_gai_ai_all" = yes; then
49    AC_DEFINE(HAVE_AI_ALL,1,[Whether you have AI_ALL])
50  fi
51
52  dnl Check for AI_IDN flag
53  AC_CACHE_CHECK([if getaddrinfo supports AI_IDN],[ac_cv_gai_ai_idn],
54  [
55    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
56#include <netdb.h>
57  ]], [[int flag = AI_IDN;]])],
58      [ac_cv_gai_ai_idn=yes], [ac_cv_gai_ai_idn=no])
59  ])
60
61  if test "$ac_cv_gai_ai_idn" = yes; then
62    AC_DEFINE(HAVE_AI_IDN,1,[Whether you have AI_IDN])
63  fi
64
65  PHP_SOCKETS_CFLAGS=-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1
66  case $host_alias in
67  *darwin*) PHP_SOCKETS_CFLAGS="$PHP_SOCKETS_CFLAGS -D__APPLE_USE_RFC_3542"
68  esac
69  PHP_NEW_EXTENSION(
70    [sockets],
71    [sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c],
72    [$ext_shared],,
73    $PHP_SOCKETS_CFLAGS)
74  PHP_INSTALL_HEADERS([ext/sockets/], [php_sockets.h])
75fi
76