trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] configure: fix cross compile detection of broken ipv6 headers
@ 2017-04-14  5:18 Baruch Siach
  0 siblings, 0 replies; only message in thread
From: Baruch Siach @ 2017-04-14  5:18 UTC (permalink / raw)
  To: Dave Jones; +Cc: trinity, Baruch Siach

Checking the content of the host ipv6.h headers is incompatible with cross
compilation. Target headers may not be the same as the host. Do direct build
test instead using the ${CC} (cross) compiler to detect headers issues.

Define _GNU_SOURCE to make sure glibc ipv6 definitions are exposed.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 configure | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index aa3f7f334971..8639a38eba96 100755
--- a/configure
+++ b/configure
@@ -51,8 +51,21 @@ echo "[*] Checking system headers."
 [ -z "$IPV6" ] && IPV6=yes
 if [[ "$IPV6" == "yes" ]]; then
 	echo -n "[*] Checking ipv6 headers ... "
-	RET=$(grep __UAPI_DEF_IN6_PKTINFO /usr/include/linux/ipv6.h)
-	if [ -z "$RET" ]; then
+	rm -f "$TMP" || exit 1
+
+	cat >"$TMP.c" << EOF
+#include <netinet/in.h>
+#include <netinet/ip6.h>
+#include <linux/in6.h>
+#include <linux/ipv6.h>
+
+int main()
+{
+	struct in6_addr test;
+}
+EOF
+	${CC} ${CFLAGS} -D_GNU_SOURCE "$TMP.c" -o "$TMP" &>"$TMP.log"
+	if [ ! -x "$TMP" ]; then
 		echo $RED "[BROKEN]" $COL_RESET "See https://patchwork.ozlabs.org/patch/425881/"
 	else
 		echo $GREEN "[OK]" $COL_RESET
-- 
2.11.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-14  5:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14  5:18 [PATCH] configure: fix cross compile detection of broken ipv6 headers Baruch Siach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).