Merge "external/qemu: Support for Signal Strength in emulator"
diff --git a/Makefile.android b/Makefile.android
index 905622e..435b295 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -78,26 +78,9 @@
 ifeq ($(HOST_OS),darwin)
     MY_CFLAGS += -mdynamic-no-pic -D_DARWIN_C_SOURCE=1
 
-    # When building on Leopard or above, we need to use the 10.4 SDK
-    # or the generated binary will not run on Tiger.
-    DARWIN_VERSION := $(strip $(shell sw_vers -productVersion))
-    ifneq ($(filter 10.1 10.2 10.3 10.1.% 10.2.% 10.3.% 10.4 10.4.%,$(DARWIN_VERSION)),)
-        $(error Building the Android emulator requires OS X 10.5 or above)
-    endif
-    ifneq ($(filter 10.5 10.5.% 10.6 10.6.%,$(DARWIN_VERSION)),)
-        # We are on Leopard or Snow Leopard
-        OSX_VERSION=10.5
-    else
-        # We are on Lion or beyond, and 10.6 SDK is the minimum in Xcode 4.x
-        OSX_VERSION=10.6
-    endif
-    MACOSX_SDK := /Developer/SDKs/MacOSX$(OSX_VERSION).sdk
-    ifeq ($(strip $(wildcard $(MACOSX_SDK))),)
-        $(info  Please install the $(OSX_VERSION) SDK on this machine at $(MACOSX_SDK))
-        $(error Aborting the build.)
-    endif
-    MY_CFLAGS += -isysroot $(MACOSX_SDK) -mmacosx-version-min=$(OSX_VERSION) -DMACOSX_DEPLOYMENT_TARGET=$(OSX_VERSION)
-    MY_LDLIBS += -isysroot $(MACOSX_SDK) -Wl,-syslibroot,$(MACOSX_SDK) -mmacosx-version-min=$(OSX_VERSION)
+    MY_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
+    MY_LDLIBS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
+
 endif
 
 # BUILD_STANDALONE_EMULATOR is only defined when building with
@@ -220,10 +203,12 @@
 
 ifeq ($(HOST_OS),darwin)
   QEMU_SYSTEM_LDLIBS += -Wl,-framework,Cocoa,-framework,QTKit,-framework,CoreVideo
-  ifneq ($(filter 10.7 10.7.% 10.8 10.8.%,$(DARWIN_VERSION)),)
-    # 10.7+ with XCode4 needs to be explicitly told the dynamic library
-    # lookup symbols in the precompiled libSDL are resolved at
-    # runtime
+
+  # SDK 10.6+ doesn't have __dyld_func_lookup anymore. Dynamic library lookup symbols
+  # are instead resolved at runtime
+  OSX_VERSION_MAJOR := $(shell echo $(mac_sdk_version) | cut -d . -f 2)
+  OSX_VERSION_MAJOR_GREATER_THAN_OR_EQUAL_TO_6 := $(shell [ $(OSX_VERSION_MAJOR) -ge 6 ] && echo true)
+  ifeq ($(OSX_VERSION_MAJOR_GREATER_THAN_OR_EQUAL_TO_6),true)
     QEMU_SYSTEM_LDLIBS += -undefined dynamic_lookup
   endif
 endif