From db221f9705a8e80213c0dc9027b86b036893ef66 Mon Sep 17 00:00:00 2001 From: Rob Gowin Date: Mon, 25 Jul 2022 08:51:18 -0400 Subject: [PATCH] Changes to compile on macOS. defines.h: Use (defined(__APPLE__) && defined(__MACH__)) to detect macOS, as suggested by https://stackoverflow.com/questions/7063303/macro-unix-not-defined-in-macos-x. Combined with __NetBSD__ to set BSD=1 and POSIX=1. main.c: Include to pick up sleep() declaration. --- defines.h | 4 ++-- main.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/defines.h b/defines.h index 1b328a4..dce2d05 100644 --- a/defines.h +++ b/defines.h @@ -2,9 +2,9 @@ #ifndef __DEFINES_H__ #define __DEFINES_H__ -#if __unix__ +#if __unix__ || (defined(__APPLE__) && defined(__MACH__)) # define UNIX 1 -# if __NetBSD__ +# if __NetBSD__ || (defined(__APPLE__) && defined(__MACH__)) # define BSD 1 # define POSIX 1 # elif __linux__ diff --git a/main.c b/main.c index 413dad1..dc3344f 100644 --- a/main.c +++ b/main.c @@ -69,6 +69,7 @@ #include "defines.h" /* OS specific customization */ #if UNIX # include +# include #endif #include "basic.h"