http://lists.gnu.org/archive/html/qemu-devel/2011-10/msg03794.html
http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00027.html
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 07c2929..229d834 100644
--- fpu/softfloat.h
+++ fpu/softfloat.h
@@ -57,7 +57,9 @@  typedef uint8_t flag;
 typedef uint8_t uint8;
 typedef int8_t int8;
 #ifndef _AIX
+#if !(defined(__APPLE__) && defined(_UINT16))
 typedef int uint16;
+#endif
 typedef int int16;
 #endif
 typedef unsigned int uint32;
diff --git a/ui/cocoa.m b/ui/cocoa.m
index d9e4e3d..ac15418 100644
--- ui/cocoa.m
+++ ui/cocoa.m
@@ -22,13 +22,14 @@
  * THE SOFTWARE.
  */

-#import <Cocoa/Cocoa.h>
-#include <crt_externs.h>
-
 #include "qemu-common.h"
 #include "console.h"
 #include "sysemu.h"

+#define _UINT16
+#import <Cocoa/Cocoa.h>
+#include <crt_externs.h>
+
 #ifndef MAC_OS_X_VERSION_10_4
 #define MAC_OS_X_VERSION_10_4 1040
 #endif
