f84394c
diff -Naur OpenImageIO-oiio-2939154.orig/src/include/thread.h OpenImageIO-oiio-2939154/src/include/thread.h
f84394c
--- OpenImageIO-oiio-2939154.orig/src/include/thread.h	2012-06-04 12:30:16.000000000 -0500
f84394c
+++ OpenImageIO-oiio-2939154/src/include/thread.h	2012-06-13 15:14:36.648990016 -0500
f84394c
@@ -103,7 +103,7 @@
f84394c
 #endif
f84394c
 
f84394c
 #if defined(__GNUC__) && (defined(_GLIBCXX_ATOMIC_BUILTINS) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 401))
f84394c
-#if !defined(__FreeBSD__) || defined(__x86_64__)
f84394c
+#if !defined(__FreeBSD__) && !defined(__PPC__) || defined(__x86_64__)
f84394c
 #define USE_GCC_ATOMICS
f84394c
 #endif
f84394c
 #endif
f84394c
@@ -272,6 +272,11 @@
011445b
 #elif defined(_WIN32)
011445b
     // Windows
011445b
     return _InterlockedExchangeAdd ((volatile LONG *)at, x);
011445b
+#elif defined (__PPC__)
011445b
+   long long r;
011445b
+   r = *at;
011445b
+   *at += x;
011445b
+   return r;
011445b
 #else
011445b
 #   error No atomics on this platform.
011445b
 #endif
f84394c
@@ -297,6 +302,11 @@
011445b
 #  else
011445b
     return InterlockedExchangeAdd64 ((volatile LONGLONG *)at, x);
011445b
 #  endif
011445b
+#elif defined (__PPC__)
011445b
+   long long r;
011445b
+   r = *at;
011445b
+   *at += x;
011445b
+   return r;
011445b
 #else
011445b
 #   error No atomics on this platform.
011445b
 #endif
f84394c
@@ -322,6 +332,8 @@
011445b
     return OSAtomicCompareAndSwap32Barrier (compareval, newval, at);
011445b
 #elif defined(_WIN32)
011445b
     return (_InterlockedCompareExchange ((volatile LONG *)at, newval, compareval) == compareval);
011445b
+#elif defined(__PPC__)
011445b
+    return ((*at == compareval) ? (*at = newval), 1 : 0);
011445b
 #else
011445b
 #   error No atomics on this platform.
011445b
 #endif
f84394c
@@ -341,6 +353,8 @@
011445b
     return OSAtomicCompareAndSwap64Barrier (compareval, newval, at);
011445b
 #elif defined(_WIN32)
011445b
     return (_InterlockedCompareExchange64 ((volatile LONGLONG *)at, newval, compareval) == compareval);
011445b
+#elif defined(__PPC__)
011445b
+    return ((*at == compareval) ? (*at = newval), 1 : 0);
011445b
 #else
011445b
 #   error No atomics on this platform.
011445b
 #endif