Commit 86201b92c336b3bbabe57a661cfe651ae9af4288

Carlos Martín Nieto 2017-02-22T16:17:54

Merge pull request #4135 from libgit2/ethomson/ancient_gcc_not_threadsafe Provide error on gcc < 4.1 when THREADSAFE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/thread-utils.h b/src/thread-utils.h
index f016198..2df2aeb 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)