xref: /php-src/ext/sockets/config.m4 (revision bb35da33)
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 sockatmark])
8  AC_CHECK_HEADERS([sys/sockio.h linux/filter.h])
9  AC_DEFINE([HAVE_SOCKETS], [1],
10    [Define to 1 if the PHP extension 'sockets' is available.])
11
12  dnl Check for field ss_family in sockaddr_storage (missing in AIX until 5.3)
13  AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],,,
14    [#include <sys/socket.h>])
15
16  dnl Check for struct ucred. Checking the header is not enough (DragonFlyBSD).
17  AC_CHECK_TYPES([struct ucred],,, [
18    #ifndef _GNU_SOURCE
19    # define _GNU_SOURCE
20    #endif
21    #include <sys/socket.h>
22  ])
23
24  AC_CHECK_TYPES([struct cmsgcred],,, [#include <sys/socket.h>])
25
26  PHP_SOCKETS_CFLAGS=-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1
27  AS_CASE([$host_alias],
28    [*darwin*],
29      [PHP_SOCKETS_CFLAGS="$PHP_SOCKETS_CFLAGS -D__APPLE_USE_RFC_3542"])
30
31  PHP_NEW_EXTENSION([sockets],
32    [sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c],
33    [$ext_shared],,
34    [$PHP_SOCKETS_CFLAGS])
35  PHP_INSTALL_HEADERS([ext/sockets], [php_sockets.h])
36fi
37