Restrict Mac OS 10.5 devices to 1 dex2oat thread.

Also make extra sure we've included the header file that tells us what Mac OS
version we're compiling for.

Change-Id: Ie57f01a325217e638df4e9b90d94b27303149124
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index e18a628..613ba67 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -37,6 +37,10 @@
 #include "timing_logger.h"
 #include "zip_archive.h"
 
+#if defined(__APPLE__)
+#include "AvailabilityMacros.h" // For MAC_OS_X_VERSION_MAX_ALLOWED
+#endif
+
 namespace art {
 
 static void UsageErrorV(const char* fmt, va_list ap) {
@@ -474,6 +478,10 @@
   bool dump_stats = kIsDebugBuild;
   bool dump_timings = kIsDebugBuild;
 
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+  thread_count = 1;
+#endif
+
   for (int i = 0; i < argc; i++) {
     const StringPiece option(argv[i]);
     bool log_options = false;
diff --git a/src/mutex.cc b/src/mutex.cc
index da1ba7a..b56f1ef 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -23,6 +23,10 @@
 #include "thread.h"
 #include "utils.h"
 
+#if defined(__APPLE__)
+#include "AvailabilityMacros.h" // For MAC_OS_X_VERSION_MAX_ALLOWED
+#endif
+
 #define CHECK_MUTEX_CALL(call, args) CHECK_PTHREAD_CALL(call, args, name_)
 
 namespace art {
diff --git a/src/utils.cc b/src/utils.cc
index 3751727..1c00712 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -39,7 +39,7 @@
 #endif
 
 #if defined(__APPLE__)
-#include "AvailabilityMacros.h"
+#include "AvailabilityMacros.h" // For MAC_OS_X_VERSION_MAX_ALLOWED
 #include <sys/syscall.h>
 #endif