Add APPLE to portability/Config
authorMichael Lee <mzlee@fb.com>
Tue, 22 Mar 2016 18:45:43 +0000 (11:45 -0700)
committerFacebook Github Bot 1 <facebook-github-bot-1-bot@fb.com>
Tue, 22 Mar 2016 18:50:21 +0000 (11:50 -0700)
Summary: And use that to guard the use of posix_memalign.

Reviewed By: benyl

Differential Revision: D3081743

fb-gh-sync-id: 2c71d9cbeeaeb59d1600d486cccfc2109699ba6b
shipit-source-id: 2c71d9cbeeaeb59d1600d486cccfc2109699ba6b

folly/portability/Config.h
folly/portability/Memory.cpp

index eede964183ff7dc1722782a7ef0adeabdb07a604..42119fccf5f5d88468a7df784b3b613c45455226 100755 (executable)
@@ -31,3 +31,7 @@
 #ifdef __ANDROID__
 #include <android/api-level.h>
 #endif
+
+#ifdef __APPLE__
+#include <Availability.h>
+#endif
index 3310c0d294a571ad2d2fd0f856f4667ffa26650d..a589027d2183f034d8a80d5d928845c2be5c38a4 100644 (file)
 
 namespace folly {
 namespace detail {
-#if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || \
-    (defined(__ANDROID__) && (__ANDROID_API__ > 15))
+#if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 ||                    \
+    (defined(__ANDROID__) && (__ANDROID_API__ > 15)) ||                      \
+    (defined(__APPLE__) && (__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6 || \
+                            __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0))
 #include <errno.h>
 
 // Use posix_memalign, but mimic the behaviour of memalign