Use an all-permissive copyright notice, recommended by RMS.
[pspp] / m4 / sockpfaf.m4
1 # sockpfaf.m4 serial 1
2 dnl Copyright (C) 2004 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License.  As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
8
9 dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
10 dnl and some common address families (AF_INET, AF_INET6, ...).
11 dnl This test assumes that a system supports an address family if and only if
12 dnl it supports the corresponding protocol family.
13
14 dnl From Bruno Haible.
15
16 AC_DEFUN([gl_SOCKET_FAMILIES],
17 [
18   AC_MSG_CHECKING(for IPv4 sockets)
19   AC_CACHE_VAL(gl_cv_socket_ipv4,
20     [AC_TRY_COMPILE([#include <sys/types.h>
21 #include <sys/socket.h>
22 #include <netinet/in.h>],
23 [int x = AF_INET; struct in_addr y; struct sockaddr_in z;],
24        gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
25   AC_MSG_RESULT($gl_cv_socket_ipv4)
26   if test $gl_cv_socket_ipv4 = yes; then
27     AC_DEFINE(HAVE_IPV4, 1, [Define to 1 if <sys/socket.h> defines AF_INET.])
28   fi
29
30   AC_MSG_CHECKING(for IPv6 sockets)
31   AC_CACHE_VAL(gl_cv_socket_ipv6,
32     [AC_TRY_COMPILE([#include <sys/types.h>
33 #include <sys/socket.h>
34 #include <netinet/in.h>],
35 [int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;],
36        gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
37   AC_MSG_RESULT($gl_cv_socket_ipv6)
38   if test $gl_cv_socket_ipv6 = yes; then
39     AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if <sys/socket.h> defines AF_INET6.])
40   fi
41 ])