Skip to contentSkip to conversation

Added a low-level endian conversion function check in configure.ac to add support for systems where only BSD-like 'betoh*(...)' functions are available (such as Android when compiling with Bionic).

PATCH New Charles Briere 1 participant 1 message May 6, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/14 Added a low-level endian conversion function check in configure.ac to add support for systems where only BSD-like 'betoh*(...)' functions are available (such as Android when compiling with Bionic).

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac                   | 10 ++++++++++
 src/bin/lttng-relayd/cmd-2-2.c |  1 +
 src/bin/lttng-relayd/main.c    |  1 +
 src/common/compat/endian.h     |  6 +++++-
 src/common/relayd/relayd.c     |  1 +
 5 files changed, 18 insertions(+), 1 deletion(-)
configure.ac +10 -0
index eee025a..618d203 100644
@@ -123,6 +123,16 @@ AC_CHECK_LIB([pthread], [pthread_create], [],
 ]
 )
 
+# Check low-level endian compat functions
+AC_CHECK_DECL(be64toh, [], 
+[
+	AC_CHECK_DECL(betoh64, [AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])], 
+	[
+		AC_MSG_ERROR([Cannot find be64toh, betoh64 or any similar functions.])
+	])
+]
+)
+
 # Check libpopt
 AC_CHECK_LIB([popt], [poptGetContext], [],
 [
src/bin/lttng-relayd/cmd-2-2.c +1 -0
index 0450fbf..09ff7f5 100644
@@ -22,6 +22,7 @@
 
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
+#include <common/compat/endian.h>
 
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
src/bin/lttng-relayd/main.c +1 -0
index 9a2b3bd..0bf3ead 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/sessiond-comm/sessiond-comm.h>
src/common/compat/endian.h +5 -1
index 2850866..b7f66cc 100644
@@ -15,11 +15,15 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifdef _COMPAT_ENDIAN_H
+#ifndef _COMPAT_ENDIAN_H
 #define _COMPAT_ENDIAN_H
 
 #ifdef __linux__
 #include <endian.h>
+#ifdef LTTNG_HAVE_BETOH64
+#define be64toh(x) betoh64(x)
+#define be32toh(x) betoh32(x)
+#endif // LTTNG_HAVE_BETOH64
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
 #else
src/common/relayd/relayd.c +1 -0
index 82bcf5f..ba7bd13 100644
@@ -26,6 +26,7 @@
 #include <common/common.h>
 #include <common/defaults.h>
 #include <common/sessiond-comm/relayd.h>
+#include <common/compat/endian.h>
 
 #include "relayd.h"
 
Signature · 1 line
1.8.1.msysgit.1