diff options
-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 610ae84..f6239e9 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 0000000..00f2f89 --- /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) |