summaryrefslogtreecommitdiff
path: root/source3/lib/replace/libreplace_network.m4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-05-21 21:27:45 +0200
committerStefan Metzmacher <metze@samba.org>2008-05-22 13:02:58 +0200
commit5797e33b8171ee77762ea96dae7744f4bda255ee (patch)
tree791722445a3997c7dd682efb38a3ea009d22ff50 /source3/lib/replace/libreplace_network.m4
parenta8045b1339153175ec294acaa59d0496e90d9e03 (diff)
downloadsamba-5797e33b8171ee77762ea96dae7744f4bda255ee.tar.gz
samba-5797e33b8171ee77762ea96dae7744f4bda255ee.tar.bz2
samba-5797e33b8171ee77762ea96dae7744f4bda255ee.zip
libreplace: add test for HAVE_IPV6
Samba can later just check libreplace_cv_HAVE_IPV6 = yes. metze (cherry picked from commit e835e7eebcc064ce0813814796828f15ad112fbd) (This used to be commit 1ca4508f3a996982a528942da1b12b94b91e94cd)
Diffstat (limited to 'source3/lib/replace/libreplace_network.m4')
-rw-r--r--source3/lib/replace/libreplace_network.m429
1 files changed, 29 insertions, 0 deletions
diff --git a/source3/lib/replace/libreplace_network.m4 b/source3/lib/replace/libreplace_network.m4
index f2d177b165..6cde6b9e0c 100644
--- a/source3/lib/replace/libreplace_network.m4
+++ b/source3/lib/replace/libreplace_network.m4
@@ -339,6 +339,35 @@ if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then
fi
fi
+dnl test for ipv6
+AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[
+ AC_TRY_COMPILE([
+#include <stdlib.h> /* for NULL */
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netdb.h>
+ ],
+ [
+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);
+ ],[
+ libreplace_cv_HAVE_IPV6=yes
+ ],[
+ libreplace_cv_HAVE_IPV6=no
+ ])
+])
+if test x"$libreplace_cv_HAVE_IPV6" = x"yes"; then
+ AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
+fi
+
LIBS=$old_LIBS
CPPFLAGS="$SAVE_CPPFLAGS"