Merge "Fix Mac Build with MacOSX SDK10.6+"
diff --git a/Makefile.android b/Makefile.android
index 0c083c0..435b295 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -80,6 +80,7 @@
 
     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
@@ -202,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.%,$(build_mac_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