From aa5ea47f7382c85d22282a093674f37fe942f116 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 22 Feb 2017 10:34:19 +0000 Subject: Provide error on gcc < 4.1 when THREADSAFE Provide a descriptive error message when compiling THREADSAFE on gcc versions < 4.1. We require the atomic primitives (eg `__sync_synchronize`) that were introduced in that version. (Note, clang setes `__GNUC__` but appears to set its version > 4.1.) --- src/thread-utils.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/thread-utils.h b/src/thread-utils.h index f0161989f..2df2aeb99 100644 --- a/src/thread-utils.h +++ b/src/thread-utils.h @@ -7,6 +7,12 @@ #ifndef INCLUDE_thread_utils_h__ #define INCLUDE_thread_utils_h__ +#if defined(__GNUC__) && defined(GIT_THREADS) +# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)) +# error Atomic primitives do not exist on this version of gcc; configure libgit2 with -DTHREADSAFE=OFF +# endif +#endif + /* Common operations even if threading has been disabled */ typedef struct { #if defined(GIT_WIN32) -- cgit v1.2.1