[LTP] [PATCH 2/2] check for RES_USE_INET6 during configure
Khem Raj
raj.khem@gmail.com
Fri Jul 26 20:25:24 CEST 2019
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
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
More information about the ltp
mailing list