diff options
author | Maxim Uvarov <maxim.uvarov@linaro.org> | 2014-12-29 17:58:52 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-01-24 00:46:15 +0300 |
commit | 223786242ef17204b17abea28de280a8f036e755 (patch) | |
tree | b3112be5ac70ff0963f331819f307c64c870f676 | |
parent | e20db47937ecc87bd4bd4964af4a35a9f0ab42cc (diff) |
configure.ac check for atomic operations support
Odp atomic operations based on compiler build-ins. Make
sure that compiler supports such operation at configure
stage.
Tested-by: Mike Holmes <mike.holmes@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | platform/linux-generic/m4/configure.m4 | 17 |
2 files changed, 20 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 610ae8431..f6239e94a 100644 --- a/configure.ac +++ b/configure.ac @@ -48,7 +48,9 @@ AC_ARG_WITH([platform], [AS_HELP_STRING([--with-platform=platform], [select platform to be used, default linux-generic])], [], - [with_platform=linux-generic]) + [with_platform=linux-generic + m4_include([./platform/linux-generic/m4/configure.m4]) + ]) AC_SUBST([with_platform]) diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 new file mode 100644 index 000000000..00f2f897b --- /dev/null +++ b/platform/linux-generic/m4/configure.m4 @@ -0,0 +1,17 @@ +AC_MSG_CHECKING(for GCC atomic builtins) +AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [[int main() { + int v = 1; + __atomic_fetch_add(&v, 1, __ATOMIC_RELAXED); + __atomic_fetch_sub(&v, 1, __ATOMIC_RELAXED); + __atomic_store_n(&v, 1, __ATOMIC_RELAXED); + __atomic_load_n(&v, __ATOMIC_RELAXED); + return 0; + } + ]])], + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + echo "GCC-style __atomic builtins not supported by the compiler." + echo "Use newer version. For gcc > 4.7.0" + exit -1) |