From 615c53bf23b3a026b90a613c6364dd6ade869cd1 Mon Sep 17 00:00:00 2001
From: Sean Leather <sean.leather@gmail.com>
Date: Thu, 30 May 2019 15:51:21 +0200
Subject: [PATCH] Set default compiler to clang on apple hosts

---
 src/lib.rs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs
index 9fef14763..704345ea1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1426,8 +1426,6 @@ impl Build {
         }
 
         if target.contains("-ios") {
-            // FIXME: potential bug. iOS is always compiled with Clang, but Gcc compiler may be
-            // detected instead.
             self.ios_flags(cmd)?;
         }
 
@@ -1682,9 +1680,12 @@ impl Build {
             ("CC", "cl.exe", "gcc", "cc", "clang")
         };
 
-        // On Solaris, c++/cc unlikely to exist or be correct.
         let default = if host.contains("solaris") {
+            // On Solaris, cc/c++ is unlikely to exist or be correct.
             gnu
+        } else if host.contains("apple") {
+            // On macOS, this allows us to correctly identify the ToolFamily.
+            clang
         } else {
             traditional
         };