From 5a1826d116ae986cb464d3503e0ae9ceaba3a687 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sat, 10 Nov 2012 22:24:56 +0100
Subject: [PATCH] Make IPv6 configurable

Add an autoconf check that verifies whether IPv6 is available or not,
and define the INET6 macro if available, instead of hardcoding it in
src/Makefile.am.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Makefile.am  | 1 -
 configure.in | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index d10c906..c983a3e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,6 @@ AM_CPPFLAGS = \
 	-DPORTMAP \
 	-DFACILITY=LOG_MAIL \
 	-DSEVERITY=LOG_INFO \
-	-DINET6 \
 	-DRPCBIND_STATEDIR="\"$(statedir)\"" \
 	-DRPCBIND_USER="\"$(rpcuser)\"" \
 	-D_GNU_SOURCE \
diff --git a/configure.ac b/configure.ac
index 2b67720..f144c8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,4 +36,7 @@ AS_IF([test x$enable_libwrap = xyes], [
 
 AC_SEARCH_LIBS([pthread_create], [pthread])
 
+AC_CHECK_HEADER(netinet/ip6.h,
+        AC_DEFINE(INET6, 1, [Define to 1 if IPv6 is available]))
+
 AC_OUTPUT([Makefile])
-- 
2.0.0

