--- include/vigra/config.hxx.orig	2017-05-19 08:01:08.000000000 -0700
+++ include/vigra/config.hxx	2017-07-31 17:35:04.000000000 -0700
@@ -166,7 +166,8 @@
     #pragma GCC diagnostic ignored "-Wshadow"
 
     #if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
-        #if defined(__APPLE__)
+        // see https://gcc.gnu.org/gcc-4.4/changes.html
+        #if __GNUC__ < 4 || ((__GNUC__ == 4) && (__GNUC_MINOR__ <= 3))
             #define VIGRA_NO_UNIQUE_PTR
         #endif
     #else
@@ -186,9 +187,11 @@
     // have totally different values than in other builds of clang.
     #if defined(__apple_build_version__)
         // (For Apple builds of clang, __clang_major__ tracks the XCode version.)
-        // For Apple builds, C++11 only works well with libc++, not stdlibc++
-        #define VIGRA_NO_UNIQUE_PTR
         #if __cplusplus >= 201103L
+            // For Apple builds, C++11 only works well with libc++, not stdlibc++
+            #if !defined(_LIBCPP_VERSION)
+                #define VIGRA_NO_UNIQUE_PTR
+            #endif
             // Must have at least XCode 4 and use libc++ to use std::shared_ptr, etc.
             // Otherwise, use tr1.
             #if !((__clang_major__ >= 4) && defined(_LIBCPP_VERSION))
