diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-02-07 18:50:07 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-02-07 18:50:07 +0100 |
commit | 373dfdd57b508fc53db33e7044c9d587eadfa62b (patch) | |
tree | f9f9a552b4abbd1ad258cd7f852956a11a7665c7 /ConfigureChecks.cmake | |
parent | 26ef6a9a79da53c67b2759f772c01195eed084e4 (diff) | |
download | socket_wrapper-373dfdd57b508fc53db33e7044c9d587eadfa62b.tar.gz socket_wrapper-373dfdd57b508fc53db33e7044c9d587eadfa62b.tar.xz socket_wrapper-373dfdd57b508fc53db33e7044c9d587eadfa62b.zip |
cmake: Check correctly for IPv6.
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r-- | ConfigureChecks.cmake | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 6cb45d0..d68578f 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -91,8 +91,46 @@ check_prototype_definition(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY_TZ) -# TODO -set(HAVE_IPV6 TRUE) +# IPV6 +check_c_source_compiles(" + #include <stdlib.h> + #include <sys/socket.h> + #include <netdb.h> + #include <netinet/in.h> + #include <net/if.h> + +int main(void) { + struct sockaddr_storage sa_store; + struct addrinfo *ai = NULL; + struct in6_addr in6addr; + int idx = if_nametoindex(\"iface1\"); + int s = socket(AF_INET6, SOCK_STREAM, 0); + int ret = getaddrinfo(NULL, NULL, NULL, &ai); + if (ret != 0) { + const char *es = gai_strerror(ret); + } + + freeaddrinfo(ai); + { + int val = 1; +#ifdef HAVE_LINUX_IPV6_V6ONLY_26 +#define IPV6_V6ONLY 26 +#endif + ret = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, + (const void *)&val, sizeof(val)); + } + + return 0; +}" HAVE_IPV6) + +check_c_source_compiles(" +#include <sys/socket.h> + +int main(void) { + struct sockaddr_storage s; + + return 0; +}" HAVE_SOCKADDR_STORAGE) # ENDIAN if (NOT WIN32) |