1AC_INIT([Haskell network package],
2        [3.1.2.1],
3        [libraries@haskell.org],
4        [network])
5
6dnl See also HsNet.h
7ac_includes_default="#define _GNU_SOURCE 1  /* for struct ucred on Linux */
8$ac_includes_default
9
10#ifdef _WIN32
11# include <winsock2.h>
12# include <ws2tcpip.h>
13# define IPV6_V6ONLY 27
14#endif
15
16#ifdef HAVE_LIMITS_H
17# include <limits.h>
18#endif
19#ifdef HAVE_STDLIB_H
20# include <stdlib.h>
21#endif
22#ifdef HAVE_UNISTD_H
23#include <unistd.h>
24#endif
25#ifdef HAVE_SYS_TYPES_H
26# include <sys/types.h>
27#endif
28#ifdef HAVE_FCNTL_H
29# include <fcntl.h>
30#endif
31#ifdef HAVE_SYS_UIO_H
32# include <sys/uio.h>
33#endif
34#ifdef HAVE_SYS_SOCKET_H
35# include <sys/socket.h>
36#endif
37#ifdef HAVE_NETINET_IN_H
38# include <netinet/in.h>
39#endif
40#ifdef HAVE_NETINET_TCP_H
41# include <netinet/tcp.h>
42#endif
43#ifdef HAVE_SYS_UN_H
44# include <sys/un.h>
45#endif
46#ifdef HAVE_ARPA_INET_H
47# include <arpa/inet.h>
48#endif
49#ifdef HAVE_NETDB_H
50#include <netdb.h>
51#endif
52#ifdef HAVE_NET_IF_H
53# include <net/if.h>
54#endif
55#ifdef HAVE_NETIOAPI_H
56# include <netioapi.h>
57#endif
58"
59
60AC_CONFIG_SRCDIR([include/HsNet.h])
61
62AC_CONFIG_HEADERS([include/HsNetworkConfig.h])
63
64AC_CANONICAL_HOST
65
66AC_ARG_WITH([cc],
67            [C compiler],
68            [CC=$withval])
69AC_PROG_CC()
70
71AC_C_CONST
72
73AC_CHECK_HEADERS([limits.h stdlib.h unistd.h sys/types.h fcntl.h])
74AC_CHECK_HEADERS([sys/uio.h sys/socket.h netinet/in.h netinet/tcp.h])
75AC_CHECK_HEADERS([sys/un.h arpa/inet.h netdb.h])
76AC_CHECK_HEADERS([net/if.h netioapi.h])
77
78AC_CHECK_TYPES([struct ucred])
79
80AC_CHECK_FUNCS([gai_strerror gethostent accept4])
81AC_CHECK_FUNCS([getpeereid])
82
83AC_CHECK_DECLS([AI_ADDRCONFIG, AI_ALL, AI_NUMERICSERV, AI_V4MAPPED])
84AC_CHECK_DECLS([IPV6_V6ONLY])
85AC_CHECK_DECLS([IPPROTO_IP, IPPROTO_TCP, IPPROTO_IPV6])
86AC_CHECK_DECLS([SO_PEERCRED])
87
88AC_CHECK_MEMBERS([struct msghdr.msg_control, struct msghdr.msg_accrights])
89AC_CHECK_MEMBERS([struct sockaddr.sa_len])
90
91dnl This is a necessary hack
92AC_MSG_NOTICE([creating ./network.buildinfo])
93echo "install-includes: HsNetworkConfig.h" > network.buildinfo
94
95AC_OUTPUT
96