I tested it on x86_64, this should be tested on other arches before
merging, namely to make sure it catches GCC version below 4.4 on ARM.

Signed-off-by: Alexandre Montplaisir <alexandre.montplai...@gmail.com>
---
 configure.ac |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0311246..d49666d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,22 @@ AS_IF([test "$host_cpu" = "armv7l"],[
        CFLAGS="$CFLAGS -mcpu=cortex-a9 -mtune=cortex-a9 -O1"
 ])
 
+# Check for GCC's __sync_* atomic operations.
+# Those are only available with GCC 4.1+ on most architectures but
+# require GCC 4.4+ on ARM.
+AC_MSG_CHECKING([for GCC atomic builtins])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[
+               int i, x = 0;
+               i = __sync_add_and_fetch(&x, 1);
+       ]])
+],[
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+       AC_MSG_ERROR([cannot find the __sync_* atomic functions.
+Please upgrade your version of GCC. GCC 4.4 or above is required on ARM.])
+])
+
 # ARM-specific checks
 AS_IF([test "x$ARCHTYPE" = "xarm"],[
        AC_MSG_CHECKING([for dmb instruction])
-- 
1.7.7.3


_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to