Changes to compile on macOS. (#2)

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 <unistd.h> to pick up sleep() declaration.

Co-authored-by: Rob Gowin <rob.gowin@gmail.com>
This commit is contained in:
Rob Gowin 2022-08-23 21:28:13 -05:00 committed by GitHub
parent ca23e6c394
commit 737fee5323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -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__

1
main.c
View File

@ -69,6 +69,7 @@
#include "defines.h" /* OS specific customization */
#if UNIX
# include <signal.h>
# include <unistd.h>
#endif
#include "basic.h"