-# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
-# define __WXOSX_IPHONE__
-# undef __WXOSX_MAC__
-# elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
-# undef __WXOSX_IPHONE__
-# define __WXOSX_MAC__
-# else
-# error "unknown SDK, neither TARGET_OS_MAC nor TARGET_OS_IPHONE set in <TargetConditionals.h>"
+# if defined(__WXOSX_IPHONE__)
+# if !( defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE )
+# error "incorrect SDK for an iPhone build"
+# endif
+# elif defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__)
+# if !( defined(TARGET_OS_MAC) && TARGET_OS_MAC )
+# error "incorrect SDK for a Mac OS X build"
+# endif
+# define __WXOSX_MAC__ 1
+# else
+# error "one of __WXOSX_IPHONE__, __WXOSX_CARBON__ or __WXOSX_COCOA__ must be defined"