summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ltp/ltp/0002-check-for-RES_USE_INET6-during-configure.patch
blob: 12e47eb2b61f78b2ad503245974138952822e8ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 7bc134545b7beb09717a60541530c20a1a5740d3 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 26 Jul 2019 10:55:28 -0700
Subject: [PATCH 2/2] check for RES_USE_INET6 during configure

glibc 2.30 has remove RES_USE_INET6 define which has been on its way out
since 2.26 release, this check ensures that we detect it before using it

Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2019-July/012955.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 configure.ac                                        | 13 +++++++++++++
 testcases/network/multicast/mc_gethost/mc_gethost.c |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/configure.ac b/configure.ac
index 2255b5c181..ed7acccb01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,19 @@ AC_CHECK_FUNCS([ \
     vmsplice \
 ])
 
+#check defines
+AC_MSG_CHECKING([for RES_USE_INET6])
+AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <resolv.h>]],
+  [[char dummy[RES_USE_INET6];]])],
+  [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED([HAVE_RES_USE_INET6], 1, [Define to 1 if you have the RES_USE_INET6 macro.])
+  ],
+  [
+    AC_MSG_RESULT([no])
+    AC_DEFINE_UNQUOTED([HAVE_RES_USE_INET6], 0, [Define to 1 if you have the RES_USE_INET6 macro.])
+  ]
+)
 # Tools knobs
 
 # Expect
diff --git a/testcases/network/multicast/mc_gethost/mc_gethost.c b/testcases/network/multicast/mc_gethost/mc_gethost.c
index 9cc15d086b..d1cae5441a 100644
--- a/testcases/network/multicast/mc_gethost/mc_gethost.c
+++ b/testcases/network/multicast/mc_gethost/mc_gethost.c
@@ -17,6 +17,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include "config.h"
+
 #ifndef LOG_PERROR
 #define LOG_PERROR 0
 #endif
@@ -50,8 +52,12 @@ usage:
 		argv++, argc--;
 	}
 	if (argc >= 1 && !strcmp(*argv, "-6")) {
+#if HAVE_RES_USE_INET6
 		af = AF_INET6, size = IN6ADDRSZ;
 		_res.options |= RES_USE_INET6;
+#else
+		af = AF_INET, size = INADDRSZ;
+#endif
 		argv++, argc--;
 	}
 	if (argc >= 1 && !strcmp(*argv, "-f")) {
-- 
2.22.0