From 7bc134545b7beb09717a60541530c20a1a5740d3 Mon Sep 17 00:00:00 2001 From: Khem Raj 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 --- 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 ]], + [[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 #include +#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