aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac93
1 files changed, 93 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7db4df29..d8d12277 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2129,6 +2129,99 @@ AC_CACHE_CHECK([[for calloc()]], [[mhd_cv_have_func_calloc]],
2129AS_VAR_IF([[mhd_cv_have_func_calloc]], [["yes"]], 2129AS_VAR_IF([[mhd_cv_have_func_calloc]], [["yes"]],
2130 [AC_DEFINE([[HAVE_CALLOC]], [[1]], [Define to 1 if you have the usable `calloc' function.])]) 2130 [AC_DEFINE([[HAVE_CALLOC]], [[1]], [Define to 1 if you have the usable `calloc' function.])])
2131 2131
2132# Some systems have IPv6 disabled in kernel at run-time
2133AS_IF([[test "x${have_inet6}" = "xyes" && test "x${cross_compiling}" = "xno"]],
2134 [
2135 AC_CACHE_CHECK([whether IPv6 could be used for testing],[mhd_cv_ipv6_for_testing],
2136 [
2137 AC_RUN_IFELSE(
2138 [
2139 AC_LANG_SOURCE([[
2140#ifdef HAVE_UNISTD_H
2141#include <unistd.h>
2142#endif
2143#ifdef HAVE_SYS_TYPES_H
2144#include <sys/types.h>
2145#endif
2146#ifdef HAVE_SYS_SOCKET_H
2147#include <sys/socket.h>
2148#endif
2149#ifdef HAVE_WINSOCK2_H
2150#include <winsock2.h>
2151#endif
2152#ifdef HAVE_WS2TCPIP_H
2153#include <ws2tcpip.h>
2154#endif
2155#ifdef HAVE_NETINET_IN_H
2156#include <netinet/in.h>
2157#endif
2158#ifdef HAVE_NETINET_IP_H
2159#include <netinet/ip.h>
2160#endif
2161#ifdef HAVE_ARPA_INET_H
2162#include <arpa/inet.h>
2163#endif
2164#ifdef HAVE_NETINET_TCP_H
2165#include <netinet/tcp.h>
2166#endif
2167
2168static void zr_mem(void *ptr, socklen_t size)
2169{ char *mem = ptr; while(size--) {mem[0] = 0; mem++;} }
2170
2171int main(void)
2172{
2173 int ret = 30;
2174 struct sockaddr_in6 sa;
2175#if !defined(_WIN32) || defined(__CYGWIN__)
2176 int sckt;
2177 const int invld_sckt = -1;
2178#else
2179 SOCKET sckt;
2180 const SOCKET invld_sckt = INVALID_SOCKET;
2181 WSADATA wsa_data;
2182
2183 WSAStartup(MAKEWORD(2, 2), &wsa_data);
2184#endif
2185 zr_mem(&sa, sizeof(sa));
2186 sa.sin6_family = AF_INET6;
2187 sa.sin6_port = 0;
2188 sa.sin6_addr = in6addr_loopback;
2189#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
2190 sa.sin6_len = sizeof(sa);
2191#endif
2192 sckt = socket (PF_INET6, SOCK_STREAM, 0);
2193 if (invld_sckt != sckt)
2194 {
2195 if (0 == bind (sckt, (struct sockaddr *)&sa, sizeof(sa)))
2196 {
2197 if (0 == listen (sckt, 1))
2198 ret = 0;
2199 else
2200 ret = 1; /* listen() failed */
2201 } else ret = 2; /* bind() failed */
2202#if !defined(_WIN32) || defined(__CYGWIN__)
2203 close (sckt);
2204#else
2205 closesocket (sckt);
2206#endif
2207 } else ret = 3; /* socket() failed */
2208#if defined(_WIN32) && !defined(__CYGWIN__)
2209 WSACleanup();
2210#endif
2211 return ret;
2212}
2213 ]])
2214 ], [[mhd_cv_ipv6_for_testing="yes"]], [[mhd_cv_ipv6_for_testing="no"]], [[mhd_cv_ipv6_for_testing="no"]]
2215 )
2216 ]
2217 )
2218 ]
2219)
2220AS_VAR_IF([mhd_cv_ipv6_for_testing],["yes"],
2221 [AC_DEFINE([[USE_IPV6_TESTING]], [[1]], [Define to 1 if your kernel supports IPv6 and IPv6 is enabled and useful for testing.])]
2222)
2223
2224
2132# Check for fork() and waitpid(). They are used for tests. 2225# Check for fork() and waitpid(). They are used for tests.
2133AC_MSG_CHECKING([[for fork()]]) 2226AC_MSG_CHECKING([[for fork()]])
2134mhd_have_fork_waitpid='no' 2227mhd_have_fork_waitpid='no'