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 | |
| parent | 26ef6a9a79da53c67b2759f772c01195eed084e4 (diff) | |
| download | socket_wrapper-373dfdd57b508fc53db33e7044c9d587eadfa62b.tar.gz socket_wrapper-373dfdd57b508fc53db33e7044c9d587eadfa62b.tar.xz socket_wrapper-373dfdd57b508fc53db33e7044c9d587eadfa62b.zip | |
cmake: Check correctly for IPv6.
| -rw-r--r-- | ConfigureChecks.cmake | 42 | ||||
| -rw-r--r-- | config.h.cmake | 22 |
2 files changed, 41 insertions, 23 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) diff --git a/config.h.cmake b/config.h.cmake index 6c9633d..97e2b1e 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -28,27 +28,7 @@ /**************************** OPTIONS ****************************/ -/* Define to 1 if you want to enable ZLIB */ -#cmakedefine WITH_ZLIB 1 - -/* Define to 1 if you want to enable SFTP */ -#cmakedefine WITH_SFTP 1 - -/* Define to 1 if you want to enable SSH1 */ -#cmakedefine WITH_SSH1 1 - -/* Define to 1 if you want to enable server support */ -#cmakedefine WITH_SERVER 1 - -/* Define to 1 if you want to enable debug output for crypto functions */ -#cmakedefine DEBUG_CRYPTO 1 - -/* Define to 1 if you want to enable pcap output support (experimental) */ -#cmakedefine WITH_PCAP 1 - -/* Define to 1 if you want to enable calltrace debug output */ -#cmakedefine DEBUG_CALLTRACE 1 - +#cmakedefine HAVE_SOCKADDR_STORAGE 1 #cmakedefine HAVE_IPV6 1 /*************************** ENDIAN *****************************/ |
