Identify host OS as Unix if so. Include unistd.h protected by UNIX define.
authorDavid Griffith <dave@661.org>
Tue, 23 Jul 2019 10:00:36 +0000 (03:00 -0700)
committerDavid Griffith <dave@661.org>
Tue, 23 Jul 2019 10:00:36 +0000 (03:00 -0700)
Makefile
src/sdl/sf_util.c

index 01766dc0627956d5e466fc7e6b40cafe6e284f16..d766d9daf8e8ebc0939607df6ad01aa53c377045 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,8 @@ CFLAGS += -Wall -std=c99 #-Wextra
 
 # Determine if we are compiling on MAC OS X
 ifneq ($(OS),Windows_NT)
+    # For now, assume !windows == unix.
+    OS_TYPE ?= unix
     UNAME_S := $(shell uname -s)
     ifeq ($(UNAME_S),Darwin)
        MACOS = yes
@@ -306,6 +308,9 @@ $(COMMON_DEFINES):
        @echo "** Generating $@"
        @echo "#ifndef COMMON_DEFINES_H" > $@
        @echo "#define COMMON_DEFINES_H" >> $@
+ifeq ($(OS_TYPE), unix)
+       @echo "#define UNIX" >> $@
+endif
 ifdef NO_BLORB
        @echo "#define NO_BLORB" >> $@
 endif
index 78d3b121d097264460e0e9a6d0a08ca24cc8ec07..0ec6090bc3580da583957224069cc5266729ddef 100644 (file)
 #include <io.h>
 #endif
 
+#ifdef UNIX
+#include <unistd.h>
+#endif
+
 f_setup_t f_setup;
 
 typedef void (*CLEANFUNC)();