Add build checks to ensure the code is being built with MIPS headers

Change-Id: I52185d0ba81baa2380740491e6695ea99da795e1
Author: Chris Dearman <chris@mips.com>
diff --git a/libportable/arch-mips/mmap.c b/libportable/arch-mips/mmap.c
index ab444c9..e772a7c 100644
--- a/libportable/arch-mips/mmap.c
+++ b/libportable/arch-mips/mmap.c
@@ -9,6 +9,10 @@
 
 extern void* __mmap2(void*, size_t, int, int, int, size_t);
 
+#if MAP_ANONYMOUS_PORTABLE==MAP_ANONYMOUS
+#error Bad build environment
+#endif
+
 static inline int mips_change_prot(int prot) {
     if (prot & PROT_SEM_PORTABLE) {
         prot &= ~PROT_SEM_PORTABLE;
diff --git a/libportable/arch-mips/open.c b/libportable/arch-mips/open.c
index e8b6c1f..6dd5a8c 100644
--- a/libportable/arch-mips/open.c
+++ b/libportable/arch-mips/open.c
@@ -5,6 +5,10 @@
 extern int  __open(const char*, int, int);
 #define O_CREAT_PORTABLE 00000100
 
+#if O_CREAT_PORTABLE==O_CREAT
+#error Bad build environment
+#endif
+
 static inline int mips_change_flags(int flags) {
     if (flags & O_CREAT_PORTABLE) {
         flags &= ~O_CREAT_PORTABLE;
diff --git a/libportable/arch-mips/socket.c b/libportable/arch-mips/socket.c
index d278384..85daadc 100644
--- a/libportable/arch-mips/socket.c
+++ b/libportable/arch-mips/socket.c
@@ -2,6 +2,10 @@
 #include <sys/socket.h>
 #include <sys/linux-syscalls.h>
 
+#if SOCK_STREAM==1
+#error Bad build environment
+#endif
+
 static inline int mips_change_type(int type) {
     switch (type) {
       case SOCK_DGRAM: return 2;