From mboxrd@z Thu Jan 1 00:00:00 1970 From: c.briere@samsung.com (Charles Briere) Date: Mon, 27 Oct 2014 20:49:30 +0000 Subject: [lttng-dev] [PATCH lttng-tools 21/24] Android : Adding bswap defintions In-Reply-To: <1414442926-14381-1-git-send-email-c.briere@samsung.com> References: <1414442926-14381-1-git-send-email-c.briere@samsung.com> Message-ID: <1414442926-14381-22-git-send-email-c.briere@samsung.com> From: Charles Briere Mapping of bswap functions based on what's available on Android's NDK Signed-off-by: Charles Briere --- configure.ac | 2 ++ src/common/compat/endian.h | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 45c6b30..91efd17 100644 --- a/configure.ac +++ b/configure.ac @@ -242,6 +242,8 @@ AC_CHECK_DECL([cmm_smp_mb__before_uatomic_or], [], AC_CHECK_DECLS([gettid], [], [], [[#include ]]) +AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64], [], [], [[#include ]]) + # Check kmod library AC_ARG_WITH(kmod-prefix, AS_HELP_STRING([--with-kmod-prefix=PATH], diff --git a/src/common/compat/endian.h b/src/common/compat/endian.h index baea531..c03c231 100644 --- a/src/common/compat/endian.h +++ b/src/common/compat/endian.h @@ -21,11 +21,20 @@ #ifdef __linux__ #include +#define HAVE_BSWAP (HAVE_DECL_BSWAP_16 && HAVE_DECL_BSWAP_32 && HAVE_DECL_BSWAP_64) +#if HAVE_BSWAP +# ifndef __bswap_16 +# define __bswap_16(x) bswap_16(x) +# define __bswap_32(x) bswap_32(x) +# define __bswap_64(x) bswap_64(x) +# endif +#endif + /* * htobe/betoh are not defined for glibc <2.9, so add them * explicitly if they are missing. */ -#ifdef __USE_BSD +#if defined(__USE_BSD) || HAVE_BSWAP /* Conversion interfaces. */ # include -- 2.1.2