diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2017-06-15 11:30:57 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2017-06-15 12:01:04 +0300 |
commit | 4c6be54266688b8027f381d335de89c130760193 (patch) | |
tree | f65acbdc4e5ddf900964e2f1cac5378cf1ed6279 /configure.ac | |
parent | 066e0ca4548c4f03662a3b86736abe6fdb75b2f9 (diff) | |
download | bdwgc-4c6be54266688b8027f381d335de89c130760193.tar.gz |
Use compiler atomic intrinsics by default if available (configure)
* README.md (Installation and Portability): Update information about
libatomic_ops usage.
* configure.ac [with_libatomic_ops=check]: AC_TRY_RUN(test_atomic_ops.c)
(before PKG_CHECK_MODULES(ATOMIC_OPS)) with -D GC_BUILTIN_ATOMIC
added to CFLAGS; set with_libatomic_ops to none if test_atomic_ops
succeeds (unless cross-compiling).
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 603773d5..1e1d489d 100644 --- a/configure.ac +++ b/configure.ac @@ -971,6 +971,18 @@ AC_ARG_WITH([libatomic-ops], [], [ AS_IF([test x"$THREADS" != xnone], [with_libatomic_ops=check], [with_libatomic_ops=none]) ]) +# Check whether compiler atomic intrinsics can be used. +if test x"$with_libatomic_ops" = xcheck; then + AC_MSG_CHECKING(for compiler intrinsics support) + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $CFLAGS_EXTRA -Iinclude -DGC_BUILTIN_ATOMIC" + AC_TRY_RUN([#include "tests/test_atomic_ops.c"], + [AC_MSG_RESULT(yes) + with_libatomic_ops=none], + [AC_MSG_RESULT(no)], [AC_MSG_RESULT(skipped because cross-compiling)]) + CFLAGS="$old_CFLAGS" +fi + # Check for an external libatomic_ops if the above answer is "yes" or "check". # If not found, fail on "yes", and convert "check" to "no". # Note: "syntax error near unexpected token ATOMIC_OPS" reported by configure |