-
Notifications
You must be signed in to change notification settings - Fork 208
Expand file tree
/
Copy pathconfigure.ac
More file actions
144 lines (125 loc) · 3.29 KB
/
Copy pathconfigure.ac
File metadata and controls
144 lines (125 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
AC_INIT([Haskell network package],
[3.2.7.0],
[libraries@haskell.org],
[network])
dnl See also HsNet.h
ac_includes_default="#ifndef _WIN32
# define _GNU_SOURCE 1 /* for struct ucred on Linux */
#endif
$ac_includes_default
#ifdef _WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
# define IPV6_V6ONLY 27
#endif
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
#ifdef HAVE_NETIOAPI_H
# include <netioapi.h>
#endif
"
AC_CONFIG_SRCDIR([include/HsNet.h])
AC_CONFIG_HEADERS([include/HsNetworkConfig.h])
AC_CANONICAL_HOST
AC_ARG_WITH([cc],
[C compiler],
[CC=$withval])
AC_PROG_CC()
AC_ARG_WITH([compiler],
[Haskell compiler],
[HC=$withval])
AC_ARG_WITH([hc],
[Haskell compiler],
[HC=$withval])
AS_IF([test -z "$HC"],
[HC=ghc])
AC_C_CONST
AC_CHECK_HEADERS([limits.h stdlib.h unistd.h sys/types.h fcntl.h])
AC_CHECK_HEADERS([sys/uio.h sys/socket.h netinet/in.h netinet/tcp.h])
AC_CHECK_HEADERS([sys/un.h arpa/inet.h netdb.h])
AC_CHECK_HEADERS([net/if.h netioapi.h])
AC_CHECK_TYPES([struct ucred])
AC_CHECK_FUNCS([gai_strerror gethostent accept4])
AC_CHECK_FUNCS([getpeereid])
AC_CHECK_DECLS([AI_ADDRCONFIG, AI_ALL, AI_NUMERICSERV, AI_V4MAPPED])
AC_CHECK_DECLS([IPV6_V6ONLY])
AC_CHECK_DECLS([IPPROTO_IP, IPPROTO_TCP, IPPROTO_IPV6])
AC_CHECK_DECLS([SO_PEERCRED])
AC_CHECK_DECLS([IP_DONTFRAG])
AC_CHECK_DECLS([IP_MTU_DISCOVER])
AC_CHECK_MEMBERS([struct msghdr.msg_control, struct msghdr.msg_accrights])
AC_CHECK_MEMBERS([struct sockaddr.sa_len])
dnl This is a necessary hack
AC_MSG_NOTICE([creating ./network.buildinfo])
echo "install-includes: HsNetworkConfig.h" > network.buildinfo
WINIO_GHC_OPTIONS=
AC_MSG_CHECKING([whether to use native Windows I/O manager RTS option])
case "$host_os" in
mingw*)
cat > conftest_ghc_cpp.hs <<EOF
#if !defined(__IO_MANAGER_WINIO__) || __IO_MANAGER_WINIO__ < 2
#error __IO_MANAGER_WINIO__ < 2
#endif
module Main where
main :: IO ()
main = return ()
EOF
if "$HC" -c -cpp -fforce-recomp conftest_ghc_cpp.hs >/dev/null 2>&1; then
AC_MSG_RESULT([yes])
WINIO_GHC_OPTIONS="-with-rtsopts=--io-manager=native"
else
AC_MSG_RESULT([no, $HC does not define __IO_MANAGER_WINIO__ >= 2])
fi
rm -f conftest_ghc_cpp.hi conftest_ghc_cpp.hs conftest_ghc_cpp.o
;;
*)
AC_MSG_RESULT([no, not Windows])
;;
esac
dnl This is an overlay for the existing test-suite in network.cabal. Cabal
dnl conditionals cannot read values produced by configure, so the probe result
dnl has to be expressed as generated build info.
AS_IF([test -n "$WINIO_GHC_OPTIONS"],
[cat >> network.buildinfo <<EOF
test-suite spec
ghc-options: $WINIO_GHC_OPTIONS
EOF
])
AC_OUTPUT