From: Khem Raj <raj.khem@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] check for RES_USE_INET6 during configure
Date: Fri, 26 Jul 2019 11:25:24 -0700 [thread overview]
Message-ID: <20190726182524.43149-2-raj.khem@gmail.com> (raw)
In-Reply-To: <20190726182524.43149-1-raj.khem@gmail.com>
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
next prev parent reply other threads:[~2019-07-26 18:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-26 18:25 [LTP] [PATCH 1/2] Add configure time check for getdents/getdents64 APIs Khem Raj
2019-07-26 18:25 ` Khem Raj [this message]
2019-07-29 11:32 ` [LTP] [PATCH 2/2] check for RES_USE_INET6 during configure Petr Vorel
2019-07-29 9:59 ` [LTP] [PATCH 1/2] Add configure time check for getdents/getdents64 APIs Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190726182524.43149-2-raj.khem@gmail.com \
--to=raj.khem@gmail.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox